1

I try to retrieve a JSON object with jQuery from a server. Some properties of this object are arrays. When these arrays are not empty, I'm able to process my object. But when I retrieve a JSON like this one :

{"Id":144,"Identifier":"4000011","ContractId":115,"ContractName":"Test4","Meters":[],"Scans":[]}

where "Meters" and "Scans" are empty, jQuery raises an error... I query my server with this code :

    $("#test").click(function () {

        $.ajax({
            type: "GET",
            url: "/Gateway/GetDetails/144",
            data: {},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data, textStatus, jqXHR) {

               ...

            },
            error: function (jqXHR, textStatus, errorThrown) { 
               ...
            }
    });

In the error handler, I can see my JSON object in the responseText property of the parameter "jqXHR". Did you encounter this problem ?

Thanks in advance !

1
  • I don't know :( I don't get a server side error. On the client, in the error handler, the parameter "errorThrown" is an empty string, and textStatus has the value "error". Not really helpful... Commented Apr 5, 2012 at 11:38

2 Answers 2

1

The JSON you've supplied is valid (as confirmed by the JSON Lint tool); is it possible that the Server you are querying is returning an HTTP Error Status Code, or that an internal error is happening on the server side. You can confirm this by using a debugging proxy like Firebug, Chrome Developer tools.

Sign up to request clarification or add additional context in comments.

1 Comment

No, I don't get a server side error, Fiddler says that the HTTP response code is 200. So I think that the error is related to jQuery, but I don't know how to prove it...
0

I answer my own question... First I tested only with Internet Explorer 9; with an other browser, all worked as expected. After I cleared the Internet Explorer cache, the problem disappeared.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.