JSFiddle - React, Tailwind, and code Playground
by klarstil
HTML
<button class="test-me">
Test me!
</button>
JavaScript
function fetchPost(id) {
id = id || 1;
return $.ajax({
'url': 'https://jsonplaceholder.typicode.com/posts/' + id
})
}
$('.test-me').on('click.test-me', function() {
fetchPost(1).done(function(response) {
alert(JSON.stringify(response));
});
});