Skip to content

Instantly share code, notes, and snippets.

@ramhoj
Created March 2, 2010 16:11
Show Gist options
  • Select an option

  • Save ramhoj/319620 to your computer and use it in GitHub Desktop.

Select an option

Save ramhoj/319620 to your computer and use it in GitHub Desktop.
$(document).ajaxComplete(function(event, request, options) {
if (request.status == 401) {
window.location = "/user_session/new";
} else if(/^text\/plain/.test(request.getResponseHeader('Content-type'))) {
if(request.responseText == ' ') {
$(document).trigger('close.facybox');
var removeVerify = window.location.href.match(/(^http.*)\?verify=1/);
if (removeVerify)
window.location = removeVerify[1];
else
window.location = '';
} else {
$.ajax($.extend(options, {'url': request.responseText, 'type': 'GET', 'data': null}));
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment