Twitter button for Random Quote Generator

Twitter button for Random Quote Generator
0

#1

Hi everyone,

I’m having a hard time getting my twitter button to work. The rest of the project has been relatively easy for me, but this has really got me stumped. If someone could take a look at my code and point me in the right direction, I would really appreciate it.


#2

When you declare twitterUrl within the $(document).ready callback function it is local to this callback function and is not part of the global scope (where your newQuote function is defined). So, the twitterUrl inside newQuote is not the same as the one in the $(document).ready callback funciton. hat the but do not set it to a value, so JavaScript assigns it the value undefined by default. One way to fix this, is by to move the newQuote function inside the $(document).ready callback function.

You have some other issues with your code related to the building of twitterURL, but that you can see what is being displayed in the alert, you should be able to resolve.


#3

Thank you for the help. I should be able to get things working now.