Answer the question
In order to leave comments, you need to log in
Ajax contact form?
Good evening, there is a feedback form and there is a handler for it:
function submitForm(){
// Переменные с данными из формы
var name = $("#name").val();
var email = $("#email").val();
var message = $("#message").val();
$.ajax({
type: "POST",
url: "php/form-process.php",
data: "name="+ name + "&email="+ email + "&message="+ message,
success : function(text){
if(text == "success"){
formSuccess();
}
}
});
}
function formSuccess(){
$( "#msgSubmit").removeClass( "hidden");
$( "#contactForm").find('input[type=text], textarea').val('');
}
Answer the question
In order to leave comments, you need to log in
Why multiple contact forms on one page?
But you can pass the form id to the submitForm function, and instead of $("#input id").val() use #input id-input id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question