讓我說我這樣鏈接$.Deferred
這樣。在jquery推遲鏈條件
$.each(data, function(k, v) {
promise.then(function() {
return $.post(...);
}).then(function(data) {
if(data)... // here is the conditions
return $.post(...);
}).then(function(data) {
if(data)... // here is another condition
return $.post(...);
})
});
promise.done(function() {
console.log("All Done!");
});
我在做對吧?如何防止如果條件返回false執行下一鏈,做這其中:
if(data){
console.log('Success');
}
代碼可以在那些.then
秒之間?
我能否在返回false之前記錄日誌? – 2013-05-03 03:38:01
@JoeySalacHipolito'if(data)'位於哪裏? – Joseph 2013-05-03 04:04:12
在所有條件下,例如,如果第一個,然後返回false,我想'的console.log()'鏈的每個狀態... – 2013-05-03 04:10:47