Skip to content

Instantly share code, notes, and snippets.

@dtipson
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save dtipson/26ef57aa0dd20d4327d8 to your computer and use it in GitHub Desktop.

Select an option

Save dtipson/26ef57aa0dd20d4327d8 to your computer and use it in GitHub Desktop.
//using the .then( successCB, failCB ) pattern
$.ajax('some-url')
.then( filter_and_format_results, filter_and_format_errors )
.done( display_results )
.fail( display_error_message );
//or, using the new .catch( failCB ) pattern
$.ajax('some-url')
.then( filter_and_format_results, )
.catch( filter_and_format_errors )
.done( display_results )
.fail( display_error_message );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment