JSFiddle - React, Tailwind, and code Playground
HTML
<div id="a"></div>
<a id="change" href="#">Change color</a>
CSS
#a {
width: 400px;
height: 200px;
background-color: red;
}
JavaScript
$('#change').click(function(e) {
e.preventDefault();
$('#a')
.css('background-color', 'blue')
.delay(500)
.queue(function(next){
$(this).css('background-color', 'red');
next();
});
$.ajax({}); // do the ajax call here
});