Random Quote Generator - Help

Random Quote Generator - Help
0.0 0


Hi guys. Stuck on this challenge. When i try to retrieve the API from this link (http://forismatic.com/en/api/) and place it in my page it ends up coming out like this

{“quoteText”:“Money was never a big motivation for me, except as a way to keep score. The real excitement is playing the game. “, “quoteAuthor”:“Donald Trump “, “senderName”:””, “senderLink”:””, “quoteLink”:“http://forismatic.com/en/c7ff2430e9/”}

I’m stuck on what I need to do to just get the text and also for it to come up with a random quote everytime

Here’s my code - http://codepen.io/saf94/pen/zKPBvJ - Please help

Edit: I’ve figured out the first bit, how to get the text right - just need help on how to get it to show a different quote everytime now!


ok what you want comes back as a object … so to get at the info you need you have to access it like you would a object eg …var obj=JSON.stringify(data); this creates a variable = to data that came back (and its a object) so to get the quote you would create a variable eg var quote … then …quote = obj.quoteText … then if you console.log(quote) you would see your quote in the console …

here is a repl to help make it clearer https://repl.it/ECrT/0


Thanks for this. I’ve figured out how to get the text right - now my only issue is how do I get it to show a different quote everytime - any ideas??


According to the link you included, the getQuote method will randomize