Bondolin
Bondolin

Reputation: 3121

AJAX returning 200 success but failing to parse response JSON

I am getting an error with a jQuery AJAX call returning a 200 success code and a parseerror on the response. I'm assuming this means jQuery got the data but couldn't parse it. However, I can retrieve the response data and it is well-formed JSON.

I am using jsonp data for cross-domain service.

jQuery

jQuery.ajax({
    url: ServiceBasePath + "/json/ZipRiders",
    dataType: "jsonp",
    success: function (data) {
        ...
    },
    error: function (a,b,c) {
        alert(a, b, c);
    }
});

Error Data

a:  Object { readyState=4, status=200, statusText="success", more...}
b:  "parsererror"
c:  Error: jQuery1101020726428059127155_1377610175566 was not called

Response

[
  {
    "AdDescription": "Taking 75 north instead of 23 just for fun",
    "AdID": "---",
    "CityName": "Highland",
    "IsWanted": false,
    "Latitude": "42.656281",
    "Longitude": "-83.63297",
    "Name": "Ride to Milford, MI",
    "NetworkLogon": "---",
    "RideNotifyEnable": true,
    "UserName": "---"
  },
  {
    "AdDescription": "Ride to jackson",
    "AdID": "---",
    "CityName": "Jackson",
    "IsWanted": false,
    "Latitude": "42.252268",
    "Longitude": "-84.38842",
    "Name": "Ride to Jackson, MI",
    "NetworkLogon": "---",
    "RideNotifyEnable": true,
    "UserName": "---"
  },
  {
      ...
  },
  {
      ...
  },
  ...
]

Upvotes: 1

Views: 1347

Answers (1)

David Hedlund
David Hedlund

Reputation: 129792

The remote server does not seem to have recognized your jsonp callback. Are you communicating with a jsonp-enabled API?

Upvotes: 1

Related Questions