Answer the question
In order to leave comments, you need to log in
How to implement loader during form submit via AJAX?
Hello! Can you please tell me how to implement a spinner or loader while the form submission is being processed? There is now a jQuery script that hides the form and shows a thank you box on successful submission:
$('form').submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "mailer/smart.php",
data: $(this).serialize()
}).done(function() {
$(this).find("input").val("");
$('.callback, .fancybox-bg, .service-popup').fadeOut('fast');
$('#thanks').fadeIn('slow');
setTimeout(function() {
$('#thanks').fadeOut('slow');
},2000);
$('form').trigger('reset');
});
return false;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question