JSFiddle - React, Tailwind, and code Playground
by JoelAndHowe
HTML
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div id="quoteDisplay">
<h1 id="quote">Quote</h1>
<h2 id="author">- Author</h2>
<button id="new">New Quote
</button>
</div>
JavaScript
$(function() {
$('#new').on('click', function(e) {
e.preventDefault();
$.ajax( {
url: 'https://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);}})});
});