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