Is http://myWebsite.com the same domain that your beforeunload code is called on? If not, then it won't work because of cross-domain policies for AJAX (XMLHttpRequest object). If so, try removing the full URL so that it's a relative path, e.g. "/ usersessions/store"
Also, make sure that: this.exportJSON() returns the expected content. You might want to just try to console.log () the data inside that beforeunload function just to check. On Nov 1, 4:31 pm, numerical25 <numerica...@aol.com> wrote: > I want to send data to a remote site but only after the customer leaves. Its > not working and I just want to make sure I am not doing anything wrong. can > anyone see anything wrong with the collowing code > > $(window).bind('beforeunload', function() > { > $.post('http://myWebsite.com/usersessions/store', {data: > this.exportJSON()}); > > }); > -- > View this message in > context:http://old.nabble.com/jquery-ajax-and-listening-for-users-exiting-the... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.