0

I've been trying all day to get the JSON data from the following url: https://www.easports.com/iframe/fifa17proclubs/api/platforms/XBOXONE/clubs/2650219/membersComplete

I am very new to cross-domain calls, I tried to use JSONP, $get.JSON with no success. All I want is to store the data from that link into an Angular variable so I can use it on my app.

  • 2
    That api is not CORS enabled and doesn't seem to support jsonp. Not all api's are ajax accessible. In cases where they are not you need to use a server side proxy...either on your server or a third party service – charlietfl Jul 29 '17 at 02:00
  • Thank you, I'll try doing that – Luis Daniel Chaparro Jul 29 '17 at 02:05
  • With XHR or Fetch or whatever JavaScript Ajax API you might be using, try with the URL `https://cors-anywhere.herokuapp.com/https://www.easports.com/iframe/fifa17proclubs/api/platforms/XBOXONE/clubs/2650219/membersComplete` and see https://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource/42744707#42744707 for an explanation – sideshowbarker Jul 29 '17 at 04:39

1 Answers1

0

This is a browser security restriction (cross site script attack) and requires the server to add the following response in the header in order for your browser-based app to access the data

Access-Control-Allow-Origin: *

If you cannot get the server to change, then there's nothing you are going to be able to do. This restriction does not exist if you create a desktop app - it's just a browser security restriction.

More information here:

https://enable-cors.org/server.html

Dean Chalk
  • 20,076
  • 6
  • 59
  • 90