August 27, 201214 yr Hi guys, I want to implement AJAX into a contact a contact form, here is the code I have so far... $("#contact_form").validate({ meta: "validate", submitHandler: function (form) { $('#contact_form').hide(); $('#sucessmessage').append("<h4 class='form_thanks'>Thanks, your email has been sent! We will get back to you as soon as possible</h4>"); return false; form.submit(); }, /* */ rules: { name: "required", lastname: "required", // simple rule, converted to {required:true} email: { // compound rule required: true, email: true }, subject: { required: true, }, message: { required: true } }, messages: { name: "Please enter your name.", lastname: "Please enter your last name.", email: { required: "Please enter email.", email: "Please enter valid email" }, subject: "Please enter a subject.", message: "Please enter a message." }, }); /*========================================*/ }); How do I implement AJAX jQuery code into this (posting to a PHP file)? Thanks Matt EDIT: Sorry about the indentation, I'm tidier than that, I blame Dreamweaver though Edited August 27, 201214 yr by Matt Maclennan
August 27, 201214 yr You would use $.ajax heres an example posting to a php file var DataString = $("#FormId").serialize(); $.ajax({ type:"POST", url:"ajax/form-parse.php", data:DataString, cache:false, success:function(html){ $("#Inter_Div").html(html); } }); if you need any further help feel free to message me Edited August 27, 201214 yr by webdesigner93
Create an account or sign in to comment