when
jQuery の関数と遅延オブジェクトを理解しようとしています。
$.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!
どうやってやるの?