Random Quote Generator code

Random Quote Generator code
0

#1

I have written my code for the random quote generator but unable to produce quotes on my website or in twitter. I suspect there is something wrong with my JS but I have been unable to fix it. I tested my API off line and it works but not in my code. Here is my codepen link:

Thanks in advance for your help!
Robert


#2

Hey, i tried to share your quote, it gives undefined, and that is because your Variables are global,
i suggest you make them inside the function as local like i did.


#3

Hi @rflynn617, I believe that your ajax’s url is your problem, replace http with https . Let me know if that worked.


#4

@NekCS

Wow! that worked…so simple. Thank you!


#5

You can always debug your code by checking your browser’s Develeport Tools, in Chrome the shortcut is F12 or you can go Settings -.> More Tools -> Developer Tools. In the Console Tab you can see your errors, console.logs etc.

Google Chrome Developer Tools
Firefox Mozilla Developer Tools