views:

85

answers:

2
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 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?

A: 

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

Gaby
A: 

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.

Donny Kurnia