Skip to content

Instantly share code, notes, and snippets.

@ZackStone
Created October 16, 2017 15:57
Show Gist options
  • Save ZackStone/75a9f99fccd896cf19c16c68c7b86c73 to your computer and use it in GitHub Desktop.
Save ZackStone/75a9f99fccd896cf19c16c68c7b86c73 to your computer and use it in GitHub Desktop.
$(document).ajaxSuccess(function (event, jqXHR, ajaxSettings) {
function extrairUrlRedirecionamento(jqXHR) {
try {
var dados = $.parseJSON(jqXHR.responseText);
if (dados == null) {
return null;
}
if (dados.RedirecionarPara == null) {
return null;
}
return dados.RedirecionarPara;
} catch (exception) {
return null;
}
}
var urlRedirecionamento = extrairUrlRedirecionamento(jqXHR);
if (urlRedirecionamento != null) {
window.location = urlRedirecionamento;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment