I tried to bind "unload" and "beforeunload" in the following code, but none of the browsers send a request:
$(window).bind('unload', function(){ $.ajax({cache: false, dataType: "script", url: "test.php" }); });
Any suggestion?
The browser did not wait for the completion of this code ... it works just fine :) Add alert('hi')to see how it works.
alert('hi')
, , unload, , ... , , , . unload. , .
unload
unload , , , DOM, , , , ( IE)... AJAX .
async false.
$(window).bind('unload', function(){ $.ajax({ cache: false, async: false, dataType: "script", url: "test.php" }); });