我在控制台中看到以下内容
\n\nGET http://localhost/FCC%20Projects/Show%20Local%20Weather/api.openweathermap.o\xe2\x80\xa69999&lat=43.3104064&APPID=4c45bb0e6071b74cf43da0d4aa498377&_=1440245698059 404 (Not Found)\nRun Code Online (Sandbox Code Playgroud)\n\n如果我取出该http://localhost/FCC%20Projects/Show%20Local%20Weather/部分并将剩余部分粘贴到浏览器栏中,我会从 api 服务获得正确的响应。 \n我在 gh-pages 上遇到相同的问题,只不过它以 GitHub 地址为前缀。 http://adoyle2014.github.io/FCC-ShowLocalWeather/
function apiCall(lat, long) {\n $.ajax({\n url: "api.openweathermap.org/data/2.5/weather?",\n jsonp: "jsonp",\n dataType: "jsonp",\n data: {\n lon: long,\n lat: lat,\n APPID: apiKey\n },\n success: function (response) {\n parseWeather(response);\n }\n });\nRun Code Online (Sandbox Code Playgroud)\n\n为什么此 api 调用会在 url 前面添加当前网站地址?
\n