.success() and .error() still supported in jQuery 1.9.1

By Sam Deering

Just a quick note that you can still use .success() and .error() in jQuery 1.9.1 and it won’t break your code. I do however highly recommend using the new promise interface with callback methods .done() and .fail() – See AJAX before jQuery 1.8 and After on code differences.

They have backwards compatiability in jQuery 1.9.1. Let’s look at the source pay attention to the alias lines.

// (v1.9.1)

// Attach deferreds (line 7835-7838)
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error =;


// Install callbacks on deferreds  (line 7951-7954)
for ( i in { success: 1, error: 1, complete: 1 } ) {
  jqXHR[ i ]( s[ i ] );


// Success/Error (line 8072-8077)
if ( isSuccess ) {
  deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
  deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

No Reader comments

Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.