Last active
March 2, 2017 05:33
-
-
Save zamicol/5d6608292d363ca89ee5a2e5453ee758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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