【发布时间】:2017-01-14 05:54:40
【问题描述】:
我尝试使用jquery when 的示例发送多个ajax 我遇到了问题,因为我不明白为什么我会生气。通常,当我尝试发送多个 ajax 时,响应很糟糕。
我这样做是这样的:
Workflow.prototype.ajaxWorkflowsPaymentProcessTransitionsAvailable = function (barcodes) {
var workflow = this;
return $.ajax({
url: "api/v1.0/workflows/paymentProcess/transitions/available",
type: "POST",
data: {barcodes: barcodes},
dataType: 'JSON'
});
};
Workflow.prototype.ajaxViewsDocuments = function (fd) {
var workflow = this;
return $.ajax({
url: "api/v1.0/views/documents",
type: "POST",
data: fd,
processData: false,
contentType: false,
dataType: 'JSON'
});
};
$.when(workflow.ajaxViewsDocuments(fd), workflow.ajaxWorkflowsPaymentProcessTransitionsAvailable(barcodes)).done(function(a1, a2){
console.log(a1, a2);
});
我在 console.log 中得到了这个:
但服务器响应如下:
我怎样才能获得返回服务器的相同响应?
【问题讨论】: