Random quotes work on CodePen but not locally

I’m pretty confused, I used this API to build the random quote machine, and it works fine on CodePen. However, when I export it to a zip and open it on my own computer, it doesn’t generate quotes (the text still turns red, I put that in there as a test).

Can anyone help me understand what’s going on?

This is the error in the browser console

XMLHttpRequest cannot load https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_=1494429985156. The 'Access-Control-Allow-Origin' header has a value 'http://null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

Url to the API makes so called ‘cross-origin’ request and its blocked.

Cross origin sharing prevents you to access API outside your current domain.

Thank you for your replies. :slight_smile: I still don’t get why this is isn’t an issue when I use CodePen though? Also, what do I do to fix it so I can create websites using my own computer?