Random Programming Quotes - Project Feedback

Random Programming Quotes - Project Feedback
0.0 0

#1

Check out my random quote machine that shows programming quotes.


#2

Instead of calling the api to get the same 44 quotes each time and randomly selecting one after clicking the New Quote button, why not make one call to the api and randomly select a quote after clicking the New Quote button?

$(document).ready(function() {
  $.getJSON("https://api.myjson.com/bins/13fykd", function(json) {
    $("#getQuote").on("click", function(){
      var x = Math.floor(Math.random() * json.length);
      $(".quote").text(json[x].quote);
      $('.author').empty();
      $(".author").append("<p>&mdash;" + "<i>" + json[x].author +"</i>" + "</p>");
      var encodeQuote = encodeURIComponent(json[x].quote);
      var tweetUrl = "https://twitter.com/intent/tweet?text=" + encodeQuote;
      $(".btn-tweet").attr("href",tweetUrl);
    });
  });
});

#3

Thanks for the suggestion. I will update it soon. Is there anything else that I can improve?