JSFiddle - React, Tailwind, and code Playground
HTML
<div id="overlay"> </div>
<div id="result">Results goes here</div>
<button>Update</button>
CSS
#overlay {
position: absolute;
background-color:#000;
width: 100%;
height: 100%;
opacity: .5;
filter: alpha(opacity=50);
z-index: 100;
display: none;
}
JavaScript
$("button").click(function() {
$("#overlay").stop(false, true).animate({
opacity: 'show'
}, 200);
var res = $.ajax({
type: "GET",
dataType: "json",
url: "/echo/json/",
async: false
}).responseText;
$("#result").html(res);
$("#overlay").stop(false, true).animate({
opacity: 'hide'
}, 200);
});