1//jQuery waiting for all ajax calls to complete b4 running
2$.when(ajaxCall1(), ajaxCall2()).done(function(ajax1Results,ajax2Results){
3 //this code is executed when all ajax calls are done
4});
5
6function ajaxCall1() {
7 return $.ajax({
8 url: "some_url.php",
9 success: function(result){
10 console.log(result);
11 }
12 });
13}
14
15function ajaxCall2() {
16 return $.ajax({
17 url: "some_url.php",
18 success: function(result){
19 console.log(result);
20 }
21 });
22}