I am working with asp.net MVC project. I do have partial views and rendering those view via AJAX call only, so I am not performing whole page refresh.
In one partial view user is making changes and calling another partial view without saving it.
So I want to force user with an alert to save changes before leaving edited partial view.
Is that possible using Javascript, jQuery or any other way?
I tried:
window.onload = function () {
window.addEventListener("beforeunload", function (e) {
alert("was checked out, please check in back.");});
};
but its working on whole page refresh only. I am not refreshing whole page only partial page using AJAX.