JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">Test: </div>

JavaScript

var i = 0;
var max = 5;
var doLoop = function() {
    if(i < max)
    {
        ajaxFuncHere(i);
        i++;
        setTimeout(doLoop, 1000);
    }
};
doLoop();

function ajaxFuncHere(x)
{
    $("#test").append(x);
}