2013-04-09 47 views

回答

1
$.when(postrequest1, postrequest2).then(function (data1,data2) { 
    // data1, data2 are arrays of the form [ "success", statusText, jqXHR ] 
}); 

,只需提供数据参数的匿名回调函数。有关更多详细信息,请参阅$.when()

+0

肯定的,但将所述'数据变量包含来自postrequest1或postrequest2的内容? – think123 2013-04-09 10:01:29

+0

@ think123:见编辑。 – Manishearth 2013-04-09 10:08:55

0

试试这个

$.when(postrequest1, postrequest2).then(function (a1,a2) { 
var jqXHR1 = a1[2]; /* arguments are [ "success", statusText, jqXHR ] */ 
    alert(jqXHR1.responseText); 

    var jqXHR2 = a2[2]; 
    alert(jqXHR2.responseText); 
}); 

A1和A1对于第一次和第二次分别Ajax请求的参数......

A1和A2阵列每个都具有键作为(success,statusText,jqXHR)

可以再处理他们单独。

文档http://api.jquery.com/jQuery.when/

+0

请参阅http://api.jquery.com/jQuery.when/ – alwaysLearn 2013-04-09 10:14:02

0

你试过吗?

$.when(postrequest1, postrequest2).then(function (postData1, postData2) { 

}); 

(只要交请求是单个的请求,否则then PARAMS可以是阵列)

相关问题