I want to execute an ajax query when one user close the window. Ive got this code:
var $jQ = jQuery.noConflict();
$jQ(window).bind('unload', function() {
$jQ.ajax({
type: "GET",
url: "http://www.mydomain.com/post_untrack.php" ,
success: function(msg){
alert("Untrack");
}
});
});
I receive the "alert" event, but the script is not executed...
post_untrack.php:
<?php
mail("myemail@mydomain.com", "Script executed", "Hooray!!!");
?>
Any idea ?
Thanks!!!