Ajax request with JQuery on page unload
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2009-11-30T18:44:08Z
Indexed on
2010/04/12
12:13 UTC
Read the original article
Hit count: 391
I'm trying to do this:
$(window).unload( function () {
$.ajax({
type: "POST",
url: "http://localhost:8888/test.php?",
data: "test",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
alert (c);
});
However, the success alert is never shown, nor does this request seem to be even hitting the server. What am I doing wrong? Thanks!
© Stack Overflow or respective owner