Onbeforeunload com mysql php

<script type="text/javascript">
window.onbeforeunload = function(){ 
    var id = document.reset.id.value;
    $.ajax({
        url: "Resetter.php",
        type: "GET",
        data: {'id':id},
        success: function (response) {
            alert(response);
        }
    });
}
</script>
Scary Shrike