2011-07-03 45 views

回答

6

我推测您正在使用对$.ajax的呼叫来执行加载#portfolio#header

从jQuery的1.5,你可以使用$.when执行行动时,多个AJAX请求已经完成:

$.when(
    $.ajax({ 
     /* options to load #portfolio */ 
    }), 
    $.ajax({ 
     /* options to load #header */ 
    }) 
).then(function() { 
    $.ajax({ 
     /* options to load #slide */ 
    }); 
}); 
0

可以嵌套Ajax调用并获得上一步的成功AJAX调用每一个步骤。

$.ajax({ // Getting portfolio hear 
    success: function(){ 
     $.ajax({ // Getting header here, on success callback of portfolio call 
      success: function(){ 
       $.ajax({ // Getting slide here, on success callback of header 
        // So on, 
       }); 
      } 
     }); 
    } 
});