I have a web page that returns this JSON when called:
[{"id":"53","desc":"Roberts"}]
I am using this jQuery to call it by AJAX:
$.ajax ({
url: rootPath + "data/topology/stations",
dataType: 'json',
data: { areaID: $("#lbxArea").val () },
success: function (data) {
// Use data for actions
},
error: function (jqXHR, textStatus, errorThrown) {
alert (textStatus);
alert (errorThrown);
}
});
I used Firebug to confirm that the data being returned is what I put on top. Despite that, I fall into the error callback and first see parsererror in an alert box, and then I see
SyntaxError: JSON.parse: expected property name or '}'
I tried having the service return
{"list":[{"id":"53","desc":"Roberts"}]}
but that didn’t change anything.
Whats the response content-type?!
Try testing this response using this:
Getting the response content-type from jQuery.Post
also try not having the dataType: ‘json’ and check the return!