I want to update status flag 1 if user working on say 'XYZ' page and immediately update 0 when user leaves this page
i can able to update flag 1 by simple update query with linq in respective controller when user enters in.
but the problem is how to update flag 0 when user leaves or closes browser window directly
i tried adding following code :
window.onload = function () {
window.addEventListener("beforeunload", function (e) {
----------AJAX FUNCTION TO UPDATE DATA HERE--------------
});
};
But the problem is how to get callback of this alert-box see the image here