我需要链接 2 个帖子的结果,并从以下位置的延迟样本开始:http ://api.jquery.com/jQuery.when/
var successFunction = function (event) { alert(event.readyState); };
var failedFunction = function (event) { alert(event.readyState); };
$.when($.ajax("/page1.php", type: 'POST'), $.ajax("/page2.php", type: 'POST'))
.then(successFunction , failedFunction );
在我的情况下,即使事件对象和 chrome 报告以下属性, failedFunction 也会始终触发:
readyState: 4
responseText: "OK"
status: 200
statusText: "OK"
使用以下表格时的结果相同:
$.when( $.ajax("/page1.php", type: 'POST'), $.ajax("/page2.php", type: 'POST'))
.then(successFunction)
.fail(failFunction);
什么是 $.when 寻找来确定成功/失败?当 readyState === 4 和 status === 200 时,我如何获得 $.when 来触发 successFunction?它是否在寻找我没有从服务器发送的其他东西?