When the user click on the OK button before redirecting how to call the delete function and then continue redirecting
$(document).ready({
window.onbeforeunload = confirmExit ;
});
function confirmExit()
{
var ele = document.getElementById ("localchanges") ;
if (ele.value == "1")
return "Changes are not saved. Discard changes?" ;
}
function delete()
{
}