Make it easier - use the attribute disabled , so that the user can see the gray button and not only understand that there is no need to press anywhere, but he could not press even with a very big desire.
Actually, you can change this attribute not only for the form submission button, but also for the entire form. Then it will be enough for you to register css-rules for form elements that will change the form, and everything will be clear to all. However, most likely, and without any special rules, you are completely satisfied with the type of form elements that have this attribute set.
You can break all the input elements on the form like this:
f.find(':input').attr("disabled", true);
Where f is a pointer to your form if you are using jQuery (and you are using it).
Separately, the button, of course, like this:
b.attr("disabled", true);
You can, of course, make a preloader, but there are much more problems with it - you will need to make its design separately, then make it separately for mobile versions, then it turns out that somewhere it looks completely wrong and does not close the necessary elements , and just in case, you will still be able to disable them, in general, solid problems.
If you also have a question about where to place the code mentioned above, in the current versions of the library, the $.ajax() entry is as follows (I give my version of the preloader when we simply disable all input elements):
$.ajax({ url: u, type: 'POST', data: d, success: function () { // }, beforeSend: function () { // запускаем прелоадер f.find(':input').attr("disabled", true); }, complete: function () { // останавливаем прелоадер f.find(':input').attr("disabled", false); }, error: function () { // } });
As it is easy to guess, one code will be executed in any case before launch, the second one in any case - at the end, regardless of the success of the ajax-request (well, unless your code in error or success does not issue an execution error faster).