Random Quote Machine.. HELP please!

,Hi guys, I have been struggling for a while now and can’t, by the life of me, get my random quote machine to produce a quote…

here is my JS code:

$(document).ready(function(){
  
function newQuote(){
  $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&callback=", function(data) {
    $("#text").html(data[0].content + " - " + data[0].title);
  }); 
};
     
  $("#get-quote").on("click", function() {
    newQuote();
  });
});

what am I doing wrong!? :((

Do you have a codepen for this? It’s easier for others to figure out what’s wrong if they can see it.

Anyway I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Have you checked the browser console? Maybe you’re getting an error because the URL uses http.

1 Like

Thank you so much, wasn’t even aware of the backtick trick!
Anyway, I just checked the browser console and that was exactly the problem, thank you!