var inst = $('[data-remodal-id=modal]').remodal(); // initialize the window
//perform ajax request
//if jquery do, as follows
$.post(ajax_url, data, function(result){
//perform actions after a successful send
inst.close();
}, "json")
var inst = $('[data-remodal-id=firstModal]').remodal();
$(document).ready(function() {
$("form").submit(function() {
var formID = $(this).attr('id');
var formNm = $('#' + formID);
var message = $(formNm).find(".msgs");
var formTitle = $(formNm).find(".formTitle");
$.ajax({
type: "POST",
url: 'https://site.ru/mail.php',
data: formNm.serialize(),
success: function(data) {
message.html(data);
formTitle.css("display", "none");
setTimeout(function() {
$('.formTitle').css("display", "block");
$('.msgs').html(");
$('input').not(':input[type=submit], :input[type=hidden]').val(");
//your code
inst.close();
}, 3000);
},
error: function(jqXHR, text, error) {
message.html(error);
formTitle.css("display", "none");
setTimeout(function() {
$('.formTitle').css("display", "block");
$('.msgs').html(");
$('input').not(':input[type=submit], :input[type=hidden]').val(");
}, 3000);
}
});
return false;
});
var $input = $('.form fieldset > input');
$input.blur(function(e) {
$(this).toggleClass('filled', !!$(this).val());
});
});
Find more questions by tags CSSJavaScript
$(document).ready(function(){$("form").submit(function(){var formID=$(this).attr('id');var formNm=$('#'+formID);var message=$(formNm).find(".msgs");var formTitle=$(formNm).find(".formTitle");$.ajax({type:"POST",url:'https://site.ru/mail.php',data:formNm.serialize(),success:function(data){message.html(data);formTitle.css("display","none");setTimeout(function(){$('.formTitle').css("display","block");$('.msgs').html(");$('input').not(':input[type=submit], :input[type=hidden]').val(");},3000);},error:function(jqXHR,text,error){message.html(error);formTitle.css("display","none");setTimeout(function(){$('.formTitle').css("display","block");$('.msgs').html(");$('input').not(':input[type=submit], :input[type=hidden]').val(");},3000);}});return false;});var $input=$('.form fieldset > input');$input.blur(function(e){$(this).toggleClass('filled',!!$(this).val());});}); - Eloy commented on June 10th 19 at 14:45
- jaeden33 commented on June 10th 19 at 14:48
- Eloy commented on June 10th 19 at 14:54
In this place call the function close window inst.close() - jaeden33 commented on June 10th 19 at 14:57
but it is inserted at the end of the html
But now all not dispatched. The window just clears all data and remains open. - Eloy commented on June 10th 19 at 15:00
Check on the real host not on the local machine.
Check if on LAN, it is likely that the query does not retrieve the information about the successful submission, and he accordingly does not success, and error
Can check it out. this function inst.close(); add the error
Well, for full details it is advisable to see what the console says after you submit the form.
Personally protestirovat your script, it works (but as he conducted test for LAN, I closed the window in error) - jaeden33 commented on June 10th 19 at 15:03
data-remodal-id
data must specify the form or leave modal? - Eloy commented on June 10th 19 at 15:12Here is recorded the data modelki
About the website. Maybe I'm not careful, quickly looked through, but why it is not found the script processing the ajax - jaeden33 commented on June 10th 19 at 15:15