I see that Chrome doesn't allow alerts in an unload
function
$(window).on('unload', function(){
alert("ciao");
});
But then how does JSFIDDLE do it?
In dev tools I can see I can tick a box that will stop execution on EventListener Breakpoints --> Load --> Unload
But I cannot see what's really going on. How do they do it?
EDIT: code
$(window).on('unload', function(){
//delete files
$.ajax({
type: "post",
url: "delete_files.php",
data: {
test: $("body").data("test_name");
prod: $("body").data("prod_name");
prodAd: $("body").data("prodAd_name");
},
dataType: "html",
success: function(returnedData){
console.log(returnedData);
}
});
});