2015-07-21 45 views
0

我开发一个移动应用程序,我通过远程API得到我的数据,但我的javascript程序返回以下错误:如何允许访问控制标题访问跨域的远程API?

XMLHttpRequest cannot load http://na.lolesports.com/api/standings.json?tournamentId=225 . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ... is therefore not allowed access.

+0

如果我记得没错出现这种情况是在服务器端不把HTTP响应中的正确跨域标头。 – Okazari

+0

如果API提供JSONP,则应使用 – 2015-07-21 14:31:23

+0

,如果将此URL输入到浏览器中,则会获得响应:http://na.lolesports.com:80/api/schedule.json?tournamentId=230&includeFinished=true&includeFuture=false&includeLive =假 也可使用一个Chrome扩展这里:https://www.google.fr/webhp?sourceid=navclient&hl=fr&ie=UTF-8#hl=fr&q=chrome+extension+allow+origin 它完美在本地使用此Chrome扩展程序,我只想在没有扩展名的情况下执行相同操作。 – eLearner

回答

相关问题