Getting JSON data on CodePen

Hi. I am trying to create this project on codepen. It is for a game that I really enjoy. I can’t seem to figure out why it will not get the data. Any help would be welcome. Thanks!

Check out the project here. :slight_smile:

The site from which you’re requesting the data blocks the requests made from other browsers. It’s the CORS issue to be specific. If you open the browser dev tools, you’d see an error like this:

Access to XMLHttpRequest at '' 
from origin '' has been blocked by 
CORS policy: No 'Access-Control-Allow-Origin' header is present on 
the requested resource. 

Search for CORS on the Google to know more about this.

By the way, you can copy the JSON directly from the above URL and store in a variable and continue with your project.

Thanks for the clarification. I can’t get into the browsers dev tools because this is a school chromebook :frowning: . The JSON file will be updating every week with new data. Do you mean copy the data and put it in a varriabe or is there some other way to request it?

Yes, I meant to copy-paste the data manually.

The other way is to create your own NodeJS server and use it as a proxy.
The way it would work is that you’d send the request to your own server, upon which your server with get the data and send back to you.

(There is no CORS restriction on the server-side environment)

Alright. Could you do it with PHP too?

The origional link is It may not have CORS restriction but CodePen does not allow HTTP requests.

I would probably need to create a HTPPS proxy in order to get the data on CodePen.

Any language would do the job. You just need to proxy it through a server.