I'm trying to make a random quote machine, so I started out with this HTML to define the elements:
<div id="quoteDisplay">
<h1 id="quote">Quote</h1>
<h2 id="author">- Author</h2>
<button id="new">New Quote</button>
</div>
$('#new').on('click', function(e) {
e.preventDefault();
$.ajax({
url: 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',
success: function(data) {
var post = data.shift();
$('#author').html(post.title);
$('#quote').html(post.content);
}
})
});
However for some reason when I click on the button, nothing happens and I don't understand where the problem is. I'm fully open to other methods of doing this.