JSFiddle - React, Tailwind, and code Playground
HTML
<div id="loader">
<div id="loading-image"></div>
</div>
CSS
#loader
{
display:none;
background-color: red;
width:32px;
height: 32px;
position: fixed;
text-align:center;
z-index:9999;
overflow: auto;
}
#loading-image {
position: absolute;
z-index: 99999;
}
JavaScript
var url = 'http://nomesito.it';
jQuery.ajax({
url: url,
type: 'POST',
data: {id: post},
success: function(data) {
jQuery("#result").html(data);
},
beforeSend:function(){
jQuery("#loading").show();
},
complete:function(){
jQuery("#loading").hide();
}
});