JSFiddle - React, Tailwind, and code Playground

by johnny000

JavaScript

function taskThatTakesSometime(callback){
    // Do stuff here that takes time
    alert("Do some intense stuff");
    alert("Do some more stuff");
    // when done call the callback
    callback();
}

function ajax(){
    //do your ajaxrequest here
    alert("calling ajax");
}

// Call your intense task and configure the
// callback for calling ajax when done
taskThatTakesSometime(function(){
    ajax();
})