Another problem with quote machine

Another problem with quote machine
0

#1

So Iโ€™m another in a lengthy row of people who has this issue. There are tons of topics on this matter and sifting through them would be a lengthy process, so please, help the poor guy :wink: Back to the point, I wrote JSONP as a result of my research through fCC Reddit, GitHub and some other sites (I understand how to JSON hardcoded stuff but JSON APIs is somewhat a dark matter for me :smiley: ). Here is my code based on Rafase282 example and some tips from Reddit and forismatic.com. I click on the button and it only changes bg colors, no quotes visible. What went wrong?

$(document).ready(function(){
$.ajaxSetup({ cache: false });
var url = โ€œhttps://crossorigin.me/http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=enโ€;
var newQuote = function(data){
$(โ€™#quotetextโ€™).text(data.quoteText);
var tweet = โ€˜https://twitter.com/intent/tweet?text=โ€™ + data.quoteText + โ€™ Author โ€™ + data.quoteAuthor;
if (data.quoteAuthor === โ€˜โ€™) {
data.quoteAuthor = โ€˜Unknownโ€™;
}
$(โ€™#quoteauthorโ€™).text(โ€˜Author: โ€™ + data.quoteAuthor);
$(โ€™#tweetโ€™).attr(โ€˜hrefโ€™, tweet);
};
$.getJSON(url, newQuote, โ€˜jsonpโ€™);

colors for bg

var colors = [โ€™#16a085โ€™, โ€˜#27ae60โ€™, โ€˜#2c3e50โ€™, โ€˜#f39c12โ€™, โ€˜#e74c3cโ€™, โ€˜#9b59b6โ€™, โ€˜#FB6964โ€™, โ€˜#342224โ€™, โ€˜#472E32โ€™, โ€˜#BDBB99โ€™, โ€˜#77B1A9โ€™, โ€˜#73A857โ€™];

on click JSON and color change

$(โ€˜buttonโ€™).on(โ€˜clickโ€™,function(){
$.getJSON(url, newQuote, โ€˜jsonpโ€™);
var randomColors = Math.floor(Math.random() * colors.length);
$(โ€˜body, .btnโ€™).css(โ€˜background-colorโ€™, colors[randomColors]);
$(โ€™#quotetextโ€™).css(โ€˜colorโ€™, colors[randomColors]);
});
});