I have following code to show a loading panel after e.g. clicking a button and making an Ajax call:
$(document).on("click", function (e) {
window.LoadingPanel.Show();
});
After the Ajax call following code makes sure the loading panel disappears again:
$(document).ajaxComplete(function() {
if (window.LoadingPanel != null) {
window.LoadingPanel.Hide();
}
});
But in some cases I redirect to another page depending on the result of the Ajax call by setting the window.location.href. In this case I want the ajaxComplete function NOT to hide the loading panel until the redirect has been succeeded.
How can I check in the ajaxComplete function if the window.location.href has been changed and the page is about to redirect?
