我正在使用jQuery 1.5.1版執(zhí)行以下ajax調(diào)用:$.ajax({ dataType: 'jsonp', data: { api_key : apiKey }, url: "http://de.dawanda.com/api/v1/" + resource + ".json", success: function(data) { console.log(data); }, error: function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); console.log(textStatus); }});服務器使用有效的json對象響應:{ "response": { "type":"category", "entries":1, "params":{ "format":"json", "api_key":"c9f11509529b219766a3d301d9c988ae9f6f67fb", "id":"406", "callback":"jQuery15109935275333671539_1300495251986", "_":"1300495252693" }, "pages":1, "result":{ "category":{ "product_count":0, "id":406, "restful_path":"/categories/406", "parent_id":null, "name":"Oberteile" } } } }但是從不調(diào)用成功回調(diào),而是由錯誤回調(diào)產(chǎn)生以下輸出:jQuery15109935275333671539_1300495251986 was not calledparsererror為什么會這樣?我沒有使用jQuery的其他庫。編輯:如果我嘗試使用“ json”作為dataType而不是“ jsonp”來進行ajax調(diào)用,則服務器將以空字符串作為響應。
具有jsonp內(nèi)容類型的jQuery.ajax請求后發(fā)生parsererror
慕田峪4524236
2019-10-30 12:44:10