"So, I want that after submitting, the next submit does nothing for a few seconds."
If you mean that you want the user to ignore the second and subsequent attempts to send, until after a certain number of seconds you can do this in several ways. Here is the first thing that came to mind:
var allowSubmit = true; $("#updatestock_form").submit(function(e){ if (!allowSubmit) return false; allowSubmit = false; setTimeout(function(){ allowSubmit = true; }, 5000);
That is, there is a flag indicating whether it is currently allowed. On a send event, if this flag is false, simply return false immediately to cancel the send event. Otherwise (if currently true ) set the flag to false , set the timeout to change the flag back, say, 5 seconds, and then continue with the existing send code.
source share