I’m almost done with the Quote Machine challenge. But there’s a little hiccup with the Twitter button I can’t seem to unstick.
Every time the page loads, a quote is generated and displayed. If you click the Tweet button on the upper right corner, a window pops up with the quote and the movie where it comes from. All good. But then when I click on the image and generate a new quote, the Twitter share text still has that very first quote in there. I can’t change it no matter what I do.
I know that the quote itself is changing. Else it wouldn’t display on the page. So why isn’t the twitter text changing too?
For anyone who runs into a similar problem, try changing how you get the Twitter API in your pen. I originally put in this script from the Twitter dev documentation at the top of my Javascript panel:
Turns out that’s completely unnecessary. I just put in https://platform.twitter.com/widgets.js as an external script in the Pen’s settings instead, and used twttr.widgets.load(); whenever I reset my quote and twitter text. Just check out my code if you want to look into it more.
twitter api is pretty simple if you simply want to twit something
also if the contents of the quote on that request don’t change it means a problem with asynchronicity, you should nest some function in another one or something
Thank you for the link! I only skimmed it for now because it’s night here and my brain’s already tired, but it looks very helpful. I’ll make sure to read it tomorrow