2016-03-28 77 views
-1

我试图从耐克商店网站使用Angulars $ http请求获得当前男士清仓鞋并将其显示在我自己的网站上。耐克没有“访问控制允许来源”标题出现在请求的资源

$http({ 
     method: 'GET', 
     url: 'http://store.nike.com/html-services/gridwallData?country=US&lang_locale=en_US&gridwallPath=mens-clearance-shoes/' 
    }).then(function successCallback(response) { 
     console.log('success',response); 
    }, function errorCallback(response) { 
     console.log('error',response); 
    }); 

但是,它给了我这个错误。

XMLHttpRequest cannot load http://store.nike.com/html-services/gridwallData?country=US&lang_locale=en_US&gridwallPath=mens-clearance-shoes/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. 

我知道它是跨源的资源共享issuse。有没有办法通过这个?我也可以合法地在我的网站上展示他们的清关产品吗?

+0

*“和也可以我在法律上展示自己的产品清除我的网站上?” *我们不能回答这个问题。 *“有没有办法通过这个”*是的,就像绕过CORS限制的许多其他相同问题所描述的一样。 –

+0

为什么不呢?他们的api是公开的,我可以在我自己的网站上使用它吗?我应该在stacklaw中提问吗? –

回答

0

添加此

myApp.config(['$httpProvider', function($httpProvider) { 
      $httpProvider.defaults.useXDomain = true; 
      delete $httpProvider.defaults.headers.common['X-Requested-With']; 
     } 
    ]); 
+0

仍然无法正常工作CORS错误 –

+0

哪个服务器正在运行? –

+0

抱歉没有看到。我正在运行节点服务器。我能够使用jQuery ajax调用来获取数据。 –

相关问题