javascriptjqueryajaxobjectjquery-1.7

jQuery 1.7.2 AJAX call throwing NS_ERROR_XPC_NOT_ENOUGH_ARGS error


I have an issue with jQuery 1.7.2 and the ajax function, in that when I call the code below I get the following error in Firefox Firebug console:

NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsIDOMLocation.replace]

    var weights= new Object();

    // weight is then manipulated in here

    $.ajax(
        {
            url: '/admin/countries/index.php',
            data: ({action: 'sort', cid: cid, weights: weights}),
            dataType: 'json',
            success: function(data){                    
                alert('suck-sess');
                                    // do stuff in here
            },
            error: function (request, status, error) {
                alert(request.responseText);
            }
        }
    )

I'm not even certain that it's successfuly making the request as when I dump out $_REQUEST["action"] in my index.php PHP it comes through blank, when it should clearly be 'sort'.

When I execute the code I don't get the success or error alert, so I can't see where the error is coming from.


Solution

  • It turned out that weights was the problem, as you can see it was defined as a JavaScript object, however I had to use JSON.stringify(weights) to pass it through as a JSON-encoded string.