Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zamicol/5d6608292d363ca89ee5a2e5453ee758 to your computer and use it in GitHub Desktop.
Save zamicol/5d6608292d363ca89ee5a2e5453ee758 to your computer and use it in GitHub Desktop.
var originalXhr; //Before jquery does it's processing.
$.ajax({
type: "POST",
url: link,
xhr: function () {
originalXhr = jQuery.ajaxSettings.xhr();
return originalXhr;
},
data: value,
success: function(data, status, xhr) {
url = originalXhr.responseURL
lastSegment = url.split('/').pop()
if (lastSegment == "login"){
window.location.replace("/login");
}else{
$(replace).html(data);
}
},
dataType: "html"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment