By Sam Deering

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

By Sam Deering
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

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 ] );
Login or Create Account to Comment
Login Create Account
Get the latest in JavaScript, once a week, for free.