JSFiddle - React, Tailwind, and code Playground

JavaScript

var f = (function() {
    for (i = 0; i < 3; i++) {
        //(function(){ 
            var xhr = new XMLHttpRequest();
            var url = "closure.php?data=your-data";
            xhr.open("GET", url, true);
            xhr.onreadystatechange = function () {
                callback(); 
            };
            xhr.send();
        //})();
    }
})();

var callback = function() {
    console.log("Hello Kitty");
};