Random Quote Generator code

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

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.

2 Likes

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

2 Likes

@NekCS

Wow! that worked…so simple. Thank you!

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

1 Like