【发布时间】:2017-07-16 02:22:02
【问题描述】:
我确定这是我在阅读 API 文档时错过的内容 - 我正在尝试在 jquery 中对请求进行硬编码以调用 openweather API,因为页面是特定于地理的:
console.log('Connected to Script.js');
$(document).ready(weatherSettings);
function weatherSettings () {
var config =
{
url: 'https://api.openweathermap.org/forecast',
data: {
id:'7281804',
appid: 'MYID'
}
};
$.ajax(config).done(displayMelbourneData);
function displayMelbourneData(callback) {
console.log(callback);
}
}
然而,我得到的错误是:net::ERR_CONNECTION_REFUSED,我终生无法弄清楚原因。
任何帮助将不胜感激。
【问题讨论】:
标签: jquery openweathermap