2
我請求從URL的JSON數據,但它給錯誤的獲取JSON從URL給出錯誤[對象對象]沒有找到
GET HTTP://本地主機:10560/[對象%20Object] 404(未找到)
var mydata;
$.getJSON({
url: 'http://free.worldweatheronline.com/feed/weather.ashx?q=City,Country&callback=?&format=json&num_of_days=2&key=1111111111111111',
dataType: 'json',
success: function (data) {
mydata = data;
console.log(mydata);
}
});
如何獲取json文件並解析它?
在你的代碼中,Url是http://free.worldweatheronline.com/feed/weather。 ashx雖然在錯誤它說http:// localhost:10560/[object%20Object] 你確定,你沒有丟失任何東西... –
看起來你已經發布了錯誤的ajax調用 – Johan