【发布时间】:2015-06-13 20:48:15
【问题描述】:
通过 AngularJs 试图访问服务器以使我以这种方式返回 JSON
modulo.controller('listaController', function($scope, $http) {
$http.get('http://api.rottentomatoes.com/api/public/v1.0/movies.json?[apyKeyBlaBla]&q=Toy+Story+3&page_limit=1').success(function(data) {
$scope.items = data;
});
});
但是当您启动应用程序时,我收到此错误:
XMLHttpRequest 无法加载 [Name Sting] 请求中不存在“Access-Control-Allow-Origin”标头 资源。因此不允许使用原点“http://localhost:8383” 访问。
解决方案在哪里? 通知我使用 netbeans 并将我的 apyKey 放在上面的字符串中,然后字符串是正确的,因为我测试了它!
【问题讨论】:
-
查看这篇文章..你会从这里得到一些想法stackoverflow.com/questions/29466380/…
标签: javascript angularjs angularjs-directive cors angular-ui-router