Help with api please (random quote generator)

I have been working on the quote generator for a few days now have watched all the videos I could find, read any and all threads related to making an api work. I have tried two apis incase my original one wasn’t working or supported, JSONP and any other suggestions I found. I have the JS section of my code pen commented into 4 parts first is the other api I used, the other three are the attempts I think were closest. Any and all help will be much appreciated!

also my html is just a basic framework I figured the api would take the most time.

here is my code pen

So you’re having an issue with the CORS response headers. I would try a different API as those two have that same issue.

If you run your files in a browser with dev tools console you can see the response.

Thanks for the response. I tried another api and still nothing. I have the console open in codepen but nothing is showing up in it. I can out put random numbers to it but I can’t get any information on the api. Am I missing something obvious?

First put your code in html and js files. Then attach your js file to the script tags and make sure you get a jquery cdn. A good place is here : . Then open your html in Chrome and run an ajax request to that api. You will see the Cors headers being denied.

You could use , , or just make a hardcoded object.

Thank you. I will give those a shot tonight. I disn’t want to hard code them because I wanted to get a grasp on apis. Thank you so much for your help!