JSFiddle - React, Tailwind, and code Playground
by alexflav23
JavaScript
/*
window.onbeforeunload = function() {
return 'You have unsaved changes!';
}*/
$(window).on("beforeunload", function() {
$.ajax("someURL", {
async: false,
data: "test",
success: function(event) {
console.log("Ajax request executed");
}
});
return "This is a jQuery version";
});