我已经使用 Ajax 通过 JSONP 检索 JSON 从跨浏览器成功连接和回调我的数据,但是返回的数据是 Sydney 的正确回调,但其他 7 个未定义。我出错的任何想法。
结果
undefined
undefined
Sydney
undefined
undefined
undefined
undefined
undefined
代码
$.ajax({
url: "xxxxxxxxxxxxxxxx&HotelID=187477&type=json",
dataType: "jsonp",
success: function(data) {
$.each(data.HotelInformationResponse, function(i,data) {
var div_data = " <div class='box'>"+data.city+"</div> ";
$(div_data).appendTo("#target");
});
},
error: function(e) {
console.log(e.message);
//alert('no');
}
});
我在这里得到回报
Request URL:https://api.eancdn.com/ean-services/rs/hotel/v3/info?cid=55505&minorRev=99&apiKey=cbrzfta369qwyrm9t5b8y8kf&locale=en_US&HotelID=187477&type=json&callback=jQuery110205582368678878993_1376612818209&_=1376612818210
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Host:api.eancdn.com
Referer:http://www.nelsonbaynsw.com/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Query String Parametersview sourceview URL encoded
cid:55505
minorRev:99
apiKey:cbrzfta369qwyrm9t5b8y8kf
locale:en_US
HotelID:187477
type:json
callback:jQuery110205582368678878993_1376612818209
_:1376612818210
Response Headersview source
Accept-Ranges:none
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:4440
Content-Type:application/json
Date:Fri, 16 Aug 2013 00:27:02 GMT
Keep-Alive:timeout=5, max=100
Server:EAN
Vary:Accept-Encoding
X-Mashery-Responder:prod-p-worker-lax-03.mashery.com