Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何返回由.post加载的页面内容,何时装入.when?_Jquery_Html_Ajax_.post_.when - Fatal编程技术网

Jquery 如何返回由.post加载的页面内容,何时装入.when?

Jquery 如何返回由.post加载的页面内容,何时装入.when?,jquery,html,ajax,.post,.when,Jquery,Html,Ajax,.post,.when,这是我的页面的基本框架: $.when(postrequest1, postrequest2).then(function () { // how do I access the results of postrequest1 and postrequest 2 here? }); 只需为匿名回调函数提供数据参数。有关更多详细信息,请参阅 只需为匿名回调函数提供数据参数。有关详细信息,请参阅。试试这个 $.when(postrequest1, postrequest2).then(func

这是我的页面的基本框架:

$.when(postrequest1, postrequest2).then(function () {
  // how do I access the results of postrequest1 and postrequest 2 here?
});
只需为匿名回调函数提供数据参数。有关更多详细信息,请参阅

只需为匿名回调函数提供数据参数。有关详细信息,请参阅。

试试这个

$.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)

然后您可以单独处理它们

文档

试试这个

$.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)

然后您可以单独处理它们

文档

您试过这个吗

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

});
(只要post请求是单个请求,否则
那么
参数可以是数组)

您尝试过这个吗

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

});

(只要post请求是单个请求,否则
then
参数可以是数组)

是,但是
data
变量是否包含来自postrequest1或postrequest2的内容?是,但是
data
变量是否包含来自postrequest1或postrequest2的内容?