I need to implement a warning message for users before they close the page, but only if the data is being processed or uploaded to the server in my asp.net web application. I initially tried using the onbeforeunload javascript event, but it doesn't seem to be suitable for my specific case.
$(document).ready(function () {
$('.saveButton').click(function () {
window.btnClicked = true;
});
});
function closeEditorWarning() {
if (window.btnClicked) {
return 'It looks like you have been uploading something -- if you leave before submitting your changes will be lost.'
}
}