Skip to content

Instantly share code, notes, and snippets.

@craigmarvelley
Created December 20, 2012 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmarvelley/4348746 to your computer and use it in GitHub Desktop.
Save craigmarvelley/4348746 to your computer and use it in GitHub Desktop.
$(document).ajaxError(function (e, xhr, settings, exception) {
var STATUS_CODE_UNAUTHORIZED = 401,
STATUS_CODE_FORBIDDEN = 403;
// If we don't have a valid session, show a login form
if (xhr.status === STATUS_CODE_UNAUTHORIZED || xhr.status === STATUS_CODE_FORBIDDEN) {
showLoginForm();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment