1

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": "---"
  },
  {
      ...
  },
  {
      ...
  },
  ...
]
Bondolin
  • 2,793
  • 7
  • 34
  • 62
  • I think we have to use `$.parseJSON()` to make it JSON object. – Muhammad Talha Akbar Aug 27 '13 at 13:39
  • can I see full json data – Moazzam Khan Aug 27 '13 at 13:40
  • 5
    You're specifying `"jsonp"`, but you're returning JSON. They aren't the same thing. http://stackoverflow.com/questions/3839966/can-anyone-explain-what-jsonp-is-in-layman-terms/3840118#3840118 – Ian Aug 27 '13 at 13:41
  • 1
    Just as a note, in JSONP you have to send a `callback=?` parameter on your URL. When the response is returned, that `callback` is evaluated and the object is parsed. You cannot simply return JSON and call it JSONP. – War10ck Aug 27 '13 at 13:42

1 Answers1

1

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

David Hedlund
  • 128,221
  • 31
  • 203
  • 222