【发布时间】:2014-04-16 01:09:33
【问题描述】:
我尝试以这种方式访问不同的域站点: http://jsfiddle.net/carolineBda/2uZnP/
我总是得到(在控制台中可见错误):
XMLHttpRequest cannot load http://www.google.fr.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://fiddle.jshell.net' is therefore not allowed access.
我已经像这样配置了 httpProvider:
app.config(['$httpProvider',function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
任何想法我错过了什么? 感谢您的帮助。
【问题讨论】: