Wynn Netherland changelog.com/posts

jQuery 1.5 released, now with Deferred Objects

jQuery 1.5 has dropped and is making its way to a CDN near you. This release sports a completely re-written Ajax module.

Also new in 1.5 are Deferred Objects, a chainable utility object to manage multiple callback queues for both synchronous an asynchronous functions akin to CommonJS Promises.

// Assign handlers immediately after making the request,
// and remember the jxhr object for this request
var jxhr = $.ajax({ url: "example.php" })
    .success(function() { alert("success"); })
    .error(function() { alert("error"); })
    .complete(function() { alert("complete"); });

// perform other work here ...

// Set another completion function for the request above
jxhr.complete(function(){ alert("second complete"); });

For more release details, be sure and check out John Resig’s blog post. Also catch John on Episode 0.2.8 if you missed it.

[Source on GitHub] [Blog post]


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00