2
接收不可解析的JSON響應。我收到了JSON罰款,但它是在這種確切的格式,我如何解析並說每個警報包含每行的值。提前謝謝了!JSONP接收不可解析的JSON
請求開始
$.ajax({
url: apiURL+'getLocations/category/'+ category +'/countyId/'+ countyId +'/searchString/'+ searchString +'?callback=?',
contentType: 'application/json',
crossDomain: true,
dataType: 'jsonp',
callback: callTest1(),
complete: function(data){
if(data.code != '400')
{
$.each(data, function(key, value) {
$.each(value, function(key, val){
alert(data.id);
})
});
}
},
success: callTest2()
});
請求端
輸出啓動
{"Location":[{"id":0,"postcodeId":85,"categoryId":0,"location":
"Enfield Island Village"},{"id":0,"postcodeId":44,"categoryId":0,
"location":"Isle of Dogs"},{"id":0,"postcodeId":269,"categoryId":0,
"location":"Isleworth"},{"id":0,"postcodeId":135,"categoryId":0,
"location":"Islington"}]
}
輸出端
以何種方式是這樣的無法分析的? – cdhowie
嗯,我找不到一種方法來讀出輸出JSON中的數據,有什麼建議嗎?我對此很陌生...感謝您的耐心等待 – user885068
輸出示例將非常感謝 – user885068