开发者

getJSON not working. got tired of js problems

function addSearchPattern(file, aStatus, aRule, aExpression, aCategory)
{
    $.getJSON(file, {
        status: aStatus,
        rule: aRule,
        expression: aExpression,
        categoryID: aCategory
    }, function(data){
        if(data.errors.length > 0)
        {
            var errorText = '';
            $.each(data.errors, function(i, errors){
                errorText += data.errors[i];
            })
            alert(errorText);
        }
    });
}

this method should work but for some unknown reason it doesn't开发者_StackOverflow中文版 work. Even if i remove the callback steps of the function(data) still won't work. I tried to access the php file using the URL with GET parameters and it works perfectly fine. It even returns the JSON object. WHAT AM I MISSING HERE?


Implement an .ajaxError() handler to help see why it fails..


Have you try to debug it in Firebug? Watch the Net tab after the AJAX request finished to verify that the request return an intended response. Check if the HTML page is valid, no missing close tag, and no javascript error in the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜