我想從openweathermap獲取天氣數據。此網址適用於我放入的座標,當我在瀏覽器欄中輸入網址時,我可以下載JSON。我試圖讓我的網頁能夠正常工作。當我運行這個代碼時,在Firebug中,我可以看到HTTP請求獲得了200個成功代碼,但由於某種原因它沒有打印響應。我沒有正確使用getJSON嗎?
var url = "http://api.openweathermap.org/data/2.5/forecast?lat="+ position.coords.latitude +"&lon=" + position.coords.longitude;
$.getJSON(url, function(res) {
console.log(res);
});