-1

I'm trying to get the current men clearance shoes from the Nike store site using Angulars $http request and display it on my own site.

 $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);
    }); 

However, it gives me this error.

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.

I know its a Cross-origin resource sharing issuse. Is there any way to by pass this? And also can I legally display their clearance products on my site?

Lunny
  • 852
  • 1
  • 10
  • 23
  • *"And also can I legally display their clearance products on my site?"* we can't answer that. *"Is there any way to by pass this"* Yes, the same way as described in many of the other identical questions regarding bypassing CORS restrictions. – Kevin B Mar 28 '16 at 15:07
  • why not? their api is public can I use it on my own site? should i ask it in stacklaw instead? – Lunny Mar 28 '16 at 15:08
  • because we aren't lawers, we can't give you legal advice (and if we do you shouldn't trust it) – Kevin B Mar 28 '16 at 15:09
  • well.. they aren't usually lawers either. – Kevin B Mar 28 '16 at 15:09
  • If their web service supports it, you may be able to use [jsonp](http://www.codeproject.com/Articles/42641/JSON-to-JSONP-Bypass-Same-Origin-Policy) to work around the cross origin problem. – Alex Chance Mar 28 '16 at 15:10
  • thanks I guess I'll just use it for personal use – Lunny Mar 28 '16 at 15:11
  • yes u can use there data as this is open – Wasiq Muhammad Mar 28 '16 at 15:20

1 Answers1

0

Add this

   myApp.config(['$httpProvider', function($httpProvider) {
            $httpProvider.defaults.useXDomain = true;
            delete $httpProvider.defaults.headers.common['X-Requested-With'];
        }
    ]);
Wasiq Muhammad
  • 3,080
  • 3
  • 16
  • 29