How to re-submit the form without reloading the page?

There is a pop-up form, and a handler for php called ajax'ohms. The page is not reloaded when the form is submitted. After you submit the form, instead, a message appears indicating the status of the shipment is gone/not gone. And re-submit the form only after reloading the page.
How to make so that the form can be resubmitted without having to restart the page?
Here is the piece of code:

Open window with form:

Here using ajax I send the form in contat_form.php.
function sendForm(name){
 var data1 = jQuery('[name=' + name + ']').serialize();
 type: 'POST',
 data: data1,
 url: '/contat_form.php',
 beforeSend: function(){
 jQuery('[name=' + name + ']').html('<div class="success2"><img src=""></div>');
 success: function(msg){
 jQuery('[name=' + name + ']').html('<div class="pop2">'+msg+'</div>');

Code contat_form.php I think is not needed. I tried to substitute the option cache: false in jQuery.ajax, but it doesn't change anything.
July 9th 19 at 13:29
1 answer
July 9th 19 at 13:31
Well you succes seems to overwrite your input
jQuery('[name=' + name + ']').html('<div class="pop2">'+msg+'</div>');

Place above your input
Change in beforeSend and success jQuery('[name=' + name + ']') jQuery('#for_progress')
And how to be? If success removed, then generally get the endless scrolling's spelled out in beforeSend. - Fern_Hickle59 commented on July 9th 19 at 13:34
: changed my answer, added the decision - Juana95 commented on July 9th 19 at 13:37
Thank you. Works. Just added over form div#for_progress.
Another question. I have some forms that use function sendForm. When after sending I open another form, then see it as a notice from the last form. Tried to add the first function sendForm before the line jQuery.ajax this line: jQuery('.#for_progress .pop2').remove();
I expected that when calling the function sendForm removed the contents of the block #for_progress, but for some reason is not removed. - Fern_Hickle59 commented on July 9th 19 at 13:40
: do not suffer, try to use the plugin - Juana95 commented on July 9th 19 at 13:43
This plugin is not suitable. It calls the Alert, I have a form in a modal window.
I decided differently. Nothing tripped jQuery('#for_progress .pop2').remove(); sendForm in, she called when you click on Submit. It was necessary to insert the function opens a window with the form. - Fern_Hickle59 commented on July 9th 19 at 13:46
It does not cause alert) he always knows. And what you are doing - he knows. There you will find. - Juana95 commented on July 9th 19 at 13:49

Find more questions by tags AJAXPHP