Skip to content

Instantly share code, notes, and snippets.

@justhamade
Created December 13, 2012 00:55
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 justhamade/4273113 to your computer and use it in GitHub Desktop.
Save justhamade/4273113 to your computer and use it in GitHub Desktop.
AJAX cross domain auth
$.ajaxSetup({$
xhrFields: {$
withCredentials: true$
},$
crossDomain: true,$
statusCode: {$
401: function(){$
// Redirec the to the login page.$
console.log('401');$
//window.location.replace('/web/#login');$
},$
403: function() {$
// 403 -- Access denied$
console.log('403');$
//window.location.replace('/web/#denied');$
}$
}$
});$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment