在Chrome上运行正常,但在Firefox上无法正常工作
function myfoo(){
// Write your logic here
$.ajax({
type: "POST",
url: "update.php",
dataType: 'json',
data: {Eventid: 'Eventid',Seats:'Seats'},
success: function (r) {}
});
}
卸载窗口时
$(window).on('beforeunload', function () {
return 'Are you sure you want to leave?';
});
卸载通话功能时
$(window).on('unload', function () {
console.log('calling ajax');
myfoo();
});
答案 0 :(得分:0)
“onbeforeunload”和“unload”都正常工作,但在您的场景中,您希望发送ajax调用。所以尝试将ajax异步更改为false。
sys.default_constraints