$.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!
我怎样才能做到这一点?
http://jsfiddle.net/lukaszr/rBFmL/
.then(console.log('get JSON ready!'));
应该:
.then(function() { console.log('get JSON ready!'); });
Fiddle