0
我有一个很大的问题,我 做了一个小的应用程序离子,angularjs,如果没有错误, 工作当我添加$http.get()
呼叫接收JSON文件 浏览器显示错误:
XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
$http.get("http://elite-schedule.net/api/leaguedata")
.success(function(data) {
deferred.resolve(data);
}) .error(function() {
console.log("Error while making HTTP call.");
deferred.reject();
});
我添加扩展Allow-Control-Allow-Origin: *
和应用程序返回运行 但我在我的手机(安卓)的问题不显示任何 我认为我们应该让这种诉求$ http.get
请,谁知道在手机显示的console.log(),就知道谁早已这个错误
错误的来源或谢谢很多
我对这个错误信息感到困惑。你想向“http:// localhost:8100”或“http:// elite-schedule.net”发出请求吗? – Michael
使用jsonp insted的json.check下面的链接http://stackoverflow.com/questions/6396623/jquery-getjson-access-control-allow-origin-issue – sarath
因为你正在开发一个混合应用程序,你最终可能会移动到科尔多瓦。看看白名单:https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html –