1$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){
2 // the code here will be executed when all four ajax requests resolve.
3 // a1, a2, a3 and a4 are lists of length 3 containing the response text,
4 // status, and jqXHR object for each of the four ajax calls respectively.
5});
6
7function ajax1() {
8 // NOTE: This function must return the value
9 // from calling the $.ajax() method.
10 return $.ajax({
11 url: "someUrl",
12 dataType: "json",
13 data: yourJsonData,
14 ...
15 });
16}
17