JSFiddle - React, Tailwind, and code Playground

JavaScript

var sndCall = function() {
    log("Before");
    $.ajax({
        url: "/echo/jsonp/",
    });
    sndCall = null;
}

function log( before ) {
    $("body").append( "<p>" + ( before ? before : "After" ) + " jsonp: " + $.active + "</p>" );
}


$.ajaxSetup({
     dataType: "jsonp",
    data: {
        text: "some text",
        number: 1
    },
    success: function( data ) {
        log("During success");
        $("body").append( "<p>" + data.text + "</p>" );
    },
    complete: function() {
        log("During complete");
        setTimeout( log, 500 );
        setTimeout( sndCall, 750 );
    }
})

//test both local and remote jsonp call
  var rootUrl = "http://fiddle.jshell.net/echo/";
log("Before");
$.ajax({
    url: rootUrl + "jsonp/"
});
setTimeout(function(){
    log("JSONP Delayed");
    
    $.ajax({
        url : rootUrl + "html/" 
    });
    
    setTimeout(function() {
       log("HTML Delayed");
    },3000);
},3000);