Opa, I need to run an ajax when closing the tab, is it possible? I tried:
window.onbeforeunload = ConfirmExit;
function ConfirmExit()
{
$.ajax({
url:'salvar.php',
data:{usuario:1, ajaxget:true},
method:'post',
success:function(data)
{
}
});
return "Mensagem de fechamento de janela....";
}
It does not work, if I remove ajax, the message is displayed normally