JSFiddle - React, Tailwind, and code Playground

JavaScript

$(document).ready(function(){
        var newToken = 1;
     
        $.get("/echo/json/",
            function() {
                newToken++;
                alert("get: " + newToken); // alerts 3 - this is the last alert
            });

        newToken++;
        alert("ready:" + newToken); // alerts 2 - this happens before the server responds
    });