JSFiddle - React, Tailwind, and code Playground

HTML

<div id='content'>
    <div id='ajaxloader'><img src="http://www.titleist.com/images/products/ball_fitting/ajax-loading.gif" width="25%" height="25%" /></div>
</div>

CSS

#ajaxloader{
    display: none;
}

JavaScript

var http = new XMLHttpRequest();
var url = "/echo/html/";
var params = "html=Response&delay=3";

http.open("POST", url, true);

http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
        document.getElementById('ajaxloader').style.display = "none";
        document.getElementById('content').innerHTML = http.responseText
    }
}
            
function BeginLoading(){
    document.getElementById('ajaxloader').style.display = "block";
    http.send(params);
}
    
BeginLoading()