Random Quote Generator cant get quote

Random Quote Generator cant get quote


Right now I’m trying to display a quote and then use the NEW QUOTE button to display a different one. I can’t seem to get any of the json to show up .

Btw im using the forismatic API and wasn’t able to find much documentation at all

Codepen link:


Check your browser’s console (Ctrl+Shft+J in Chrome) and you will see an error message related to you trying to access and insecure page (http://) instead of a secure page (https://). Also, your url is incorrect. You should use:


Now, at first glance you would think this is all you need to do, but since you are using an anchor tag for your “click” event, you need to prevent it from trying to load a link. Even though you have href="", the page basically loads itself again instead of executing the code in your getJSON call. To prevent that, you need to add an argument (let’s call it event) to your click callback function. Then, add a new line above your getJSON line like:


This should get you a quote.


Thank you! That would have taken me forever to figure out