簡體   English   中英

AJAX返回200成功,但無法解析響應JSON

[英]AJAX returning 200 success but failing to parse response JSON

jQuery AJAX調用返回200成功代碼和響應上的parseerror時出現錯誤。 我假設這意味着jQuery得到了數據但無法解析它。 但是,我可以檢索響應數據,它是格式正確的JSON。

我正在使用jsonp數據進行跨域服務。

jQuery的

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

錯誤數據

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

響應

[
  {
    "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": "---"
  },
  {
      ...
  },
  {
      ...
  },
  ...
]

遠程服務器似乎無法識別您的jsonp回調。 您是否正在與啟用jsonp的API通信?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM