I recently read an article about turning the “asynchronous-ness” up a notch. His reasoning was very good, response times keep users on the site longer. Lets go in to more detail.
Ajax requests allow users to stay on the same page, while the site contacts the server in the background. This may be to post some information, or retrieve information, and the polite thing to do these days is to indicate to the user “Yes, we’re processing your request, please wait..”. But the claim here is there is no need to keep the user waiting. It’s pointless and they may as well have done a complete page reload.
Since we can use asynchronous requests the user can continue what they were doing, while the page request runs in the background. This makes the response “feel” faster to the user, even though it may not technically be. Now the problem comes in when the user navigates the browser away from the page before an ajax request has completed, causing data incomplete data, or loss of data. Where is the line drawn where it is “safe” to use this method. To keep all data integrity I would have to say never.
However, I’m not going to say “never”. Fact I believe with a little though we can avoid this almost always. He notes that Google Mail nicely displays a message which is visible, but not in the way of the user moving on to their next task. And although its ugly we could easily add onbeforeunload listeners to warn the user about navigating away from the page, then remove the listener when the request successfully completes.
So my thoughts are, why not?