I have a simple confirm button
var leave=confirm("are you sure you want to leave? Information you have entered will be lost!");
Is there anyway to use ajax (jquery+ajax is my only ajax experience) to write some data to a file if the user decides to leave the page? That way I can collect his or her name, IP, &c. so I have a confirmation who has cancelled the order mid-way through. I was thinking about collecting the data in the form fields with jquery before I wrote to the file, if that makes any difference.