Stop user to submit form twice.

This is a common problem in web applications when the latency of form submissions, sometimes several seconds or longer, gives users an opportunity to press the submit button multiple times, causing all manner of grief for the server-side code.
For our solution, we’ll hook into the form’s submit event and disable the submit
button after its first press. That way, users won’t get the opportunity to click
the submit button more than once and will get a visual indication (assuming that
disabled buttons appear so in their browser) that the form is in the process of
being submitted. following is the solution with jquery:

$("form").submit(function() {
$(":submit",this).attr("disabled", "disabled");

Within the body of the event handler, we grab all submit buttons that are inside
our form with the :submit selector and modify the disabled attribute to the value