JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btnGetData">
Click me
</button>
JavaScript
$("#btnGetData").on("click", function(){
$('html,body').css('cursor','wait');
$.ajax({
type: 'GET',
url: '/echo/html',
contentType: 'text/plain',
data: {
html: "<div>Some sample data</div>",
// delay: 5
},
cache: false
})
.done(function() {
console.log('hey, success!');
})
.fail(function() {
alert("Bummer!");
})
.always(function() {
console.log('always done! This will be called pass or fail');
$('html,body').css('cursor','pointer');
})
});