Is there a jQuery event that I can monitor if form

2019-06-26 01:06发布

问题:

I have some Javascript code on a form submit that greys out a table of data and overlays a loading image to indicate that the reload is occurring.

The problem is that if the page reload is cancelled by the user, the table stays greyed out. I would like to notice if the page submit was cancelled, and if so, fade the table back in and remove the overlay.

My question is: Is there an event I can bind to using either straight Javascript or jQuery for when loading of a new page is cancelled?

I've googled quite a bit for something, but if there's an answer, I can't see it amidst the mass of people asking how to cancel a submit action.

回答1:

How about having an event handler for the user cancel that undoes the grey out? I.e. rather than waiting to be alerted of the cancel, become the handler of the cancel.