【发布时间】:2017-01-19 07:13:50
【问题描述】:
所以,我的代码是
$.getJSON("https://api.forecast.io/forecast/API_KEY/55.9931803,92.773715", function(data){
console.log(data);
})
但是控制台是空的。没有错误,什么都没有。我做错了什么?
【问题讨论】:
-
data可能是空的 -
不,不是。当你把它放在浏览器中时,url 可以正常工作
-
你错过了留言吗:
XMLHttpRequest cannot load https://api.forecast.io/forecast/099d7717a79a457e72fd4b3e6e54c89c/55.9931803,92.773715?_=1473625797525. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://stackoverflow.com' is therefore not allowed access. -
尝试放置
console.log('test')以查看代码是否实际执行。
标签: javascript api console