【发布时间】:2013-03-09 11:58:30
【问题描述】:
我正在尝试理解 jQuery 中的 when 函数和延迟对象。
$.when($.getJSON('/echo/json', function () {
console.log('sucess');
}, function () {
console.log('error');
})).then(console.log('get JSON ready!'));
这个例子返回:
get JSON ready!
sucess
...但我想先触发成功回调:
sucess
get JSON ready!
我该怎么做?
【问题讨论】:
标签: javascript jquery jquery-deferred deferred