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:
jQuery('.reserve').click(function(){
jQuery('#ModalReserve').arcticmodal();
});
Here using ajax I send the form in contat_form.php.
function sendForm(name){
var data1 = jQuery('[name=' + name + ']').serialize();
jQuery.ajax({
type: 'POST',
data: data1,
url: '/contat_form.php',
beforeSend: function(){
jQuery('[name=' + name + ']').html('<div class="success2"><img src="http://www.cee-sinaloa.org.mx/imagenes/loading.gif"></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.
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
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