Help with forismatic API for random quote generator project?

Hey everybody! First time poster here, go easy on me! :slight_smile:

So I’ve been working on the random quote generator intermediate front-end project. In my search for an API to use to generate the quotes, my frontrunner was the Forismatic API at It’s free and unlimited which suits my needs perfectly, except for one problem: I just can’t get it to work! I keep getting a CORS error which says I am not allowed access because “no access-control-allow-origin header is set on the requested resource”. I read the CORS documentation to see if I could find a solution, but I couldn’t understand much of it. Help? Here’s a link to my codepen project:

The relevant get request is commented out near the top of my JS code. I went ahead and hard coded an object with a bunch of quotes in it to continue with the project, but I’d really like to do it with an API. Please help!

There are a couple of options to use the forismatic API. One is to use a CORS proxy. Another is to use JSONP method. The latter has some potential security implications, so you should only use it with a trusted site. There is a great thread on the forum (see below) which discusses using JSONP and/or CORS.