Hello All!
I created a very bare-bones random quote machine. https://codepen.io/megthekiwi/full/qrGKYZ/
It uses the Random Famous Quotes API available thru MashApe.
One thing I noticed is that if the quote contains a semicolon, the entire quote gets “cut-off” at that semi-colon when you try to tweet it.
For example, take this quote:
When one person suffers from a delusion it is called insanity; when many people suffer from a delusion it is called religion. - Robert Pirsig
The JSON returned from the API looks like this:
Object {
author: “Robert Pirsig”,
category: “Famous”,
quote: “When one person suffers from a delusion it is called insanity; when many people suffer from a delusion it is called religion.”
}
I set a variable called quoteString like this:
quoteString = data.quote + " - "+ data.author;
It displays correctly on the webpage itself, but when I hit the “Tweet It” button, the quote gets cut off at the semicolon. Displaying just…
“When one person suffers from a delusion it is called insanity”
… as what you can tweet.
I’m going to investigate different ways to build the tweet button such that the whole quote gets passed even when it has a semicolon. If anyone has some thoughts for me, please pass it along.