All over my CMS I have buttons that toggle something on or off by sending an ajax request, updating the db, and then changes state and value of the button on success. Very basic "ajax" and "toggle". It could be anything: publishing an article, deactivating a user, or closing a poll.
The actual server response time is pretty fast, but not instant. At first I showed a progress indicator inside the button, but it can give a laggy feel when you click one and want to move on to another, so I sped up the response by immediately changing to the other toggle state, and deactivating the button for the short time while the request is pending. If the request failed (which it never should), I change the button to an error state and disable it completely. I'm not concerned with the "in-between" time, because typically the button will be clicked once, not repeatedly.
This makes a huge positive difference in how the interface feels, but I have some concerns:
- If for some reason there is an error, it might not be seen by someone moving really quickly through the control panel.
- What happens if the user goes to a new page during that 0.5 seconds while the request is pending, will it be aborted?
- Is this a really bad idea, and should I always wait for the server response?
- What else I can to to improve the feel and/or speed up the perceived response time?