2011-07-03 28 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, 
       }); 
      } 
     }); 
    } 
});