JQuery 1.5 promises a better future.
One of the new features of the unreleased JQuery 1.5 is a new $.ajax module. Apart from many bug fixes, the most interesting, and useful part for me is that it now uses promises . Those familiar with python and twisted, or the JavaScript library mockikit, Dojo Deferred, or java.util.concurrent.Future might know these as deferreds or futures. jQuery is using promises, and not futures. They are similar but slightly different. It's a very commonly used technique in concurrency libraries now - so it is good that jQuery has hopped on board. Since jQuery always returns a promise, you can now add callbacks even after you have done the call... or even change the callback later. jQuery.getJSON( url ).error( errorCallback ) Pluggable ajax lets us test more easily The other great thing(from a testing perspective) is that jQuery now allows you to use plug in mock implementations. This lets you make a fake ajax implementation for your unit tests more easily. This pluggable architecture co