var xhr1 = $.ajax({ url:'/echo/json/', data:{ delay: 3 } }),
xhr2 = $.ajax({ url:'/echo/json/something/invalid', data:{ delay: 3 } });
xhr1.always(function(){
console.log('xhr1 always');
});
xhr2.always(function(){
console.log('xhr2 always');
});
$.when.apply($, [xhr1, xhr2]).always(function(){
console.log('xhr1 & xhr2 always');
});
결과 (콘솔) 발사? 상태에 관계없이 모든 요청이 완료 될 때 사용할 수있는 지연된 콜백이 있습니까? 그들 모든이 resolved
을 때deferred.always()는 너무 일찍
을()', 단지 추가'그에게') (그 때는 당신은 모든 대기 할 수있는 수단이 있어야합니다 응답. – DevlshOne
@DevlshOne 두 호출이 모두 성공하면'then()'만 호출됩니다. – Johan
맞습니다. 통화가 실패하더라도 OP가 결과를 원한다고 말하는 것입니까? – DevlshOne