Answers for "jquery wait for all ajax requests to complete"

1

jquery wait for all ajax requests to complete

//jQuery waiting for all ajax calls to complete b4 running
$.when(ajaxCall1(), ajaxCall2()).done(function(ajax1Results,ajax2Results){
    //this code is executed when all ajax calls are done
});

function ajaxCall1() {
    return  $.ajax({
        url: "some_url.php",
        success: function(result){
            console.log(result); 
        }
    });
}   

function ajaxCall2() {
    return  $.ajax({
        url: "some_url.php",
        success: function(result){
            console.log(result); 
        }
    });
}
Posted by: Guest on July-31-2019

Code answers related to "jquery wait for all ajax requests to complete"

Code answers related to "Javascript"

Browse Popular Code Answers by Language