Apologies if this is simplistic; I am new to JQuery. I have searched and found questions like this, but they don't seem to quite answer my question.
I am using JQuery to show a dumb progress indicator for actions that take a long time:
$(document).ready(function() {
$('form').submit(function() {
$('#progress').show();
});
});
When the user clicks a form button, I just show a div with an animated gif. This div is visible for the rest of the time the page is visible. After the form's action is complete, a new page loads.
This works well, but what if the user clicks "stop" in the browser before the action completes? How can I make the div disappear? Is there a way to catch this event, or is there a better way to handle the whole situation?
Thanks for your help.