JSFiddle - React, Tailwind, and code Playground

by Ufuk Ozdemir

HTML

<p>Look at the console</p>

JavaScript

var xhrCount = 0;
function sendXHR() {
    var seqNumber = ++xhrCount;
    console.log("Sending XHR #" + seqNumber);
    $.post("/echo/json/", {
        delay: Math.floor(Math.random() * 5)
    }, function () {
        if (seqNumber === xhrCount) {
            console.log("Received XHR #" + seqNumber + ", Process the response");
        } else {
            console.log("Received XHR #" + seqNumber + ", Ignore the response");
        }
    });
}
sendXHR();
sendXHR();
sendXHR();