JQuery warten Sie auf alle AJAX -Anfragen zu vervollständigen

//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); 
        }
    });
}
Grepper