JSFiddle - React, Tailwind, and code Playground
HTML
<button>Click</button>
JavaScript
$('button').click(function() {
var button = $(this);
//or in the ajax beforeSend function
button.prop('disabled', true);
$.ajax({
url: 'http://jsfiddle.net/echo/html/',
//or directly after the user clicked the button
beforeSend: function() {
$('button').prop('disabled', true);
},
...
//complete or success callback
complete: function() {
setTimeout( function() {
button.prop('disabled', false);
}, 100);
}
});
});