我想将 AJAX 实现为联系表单,这是我到目前为止的代码......
$("#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."
},
}); /*========================================*/
});
如何在其中实现 AJAX jQuery 代码(发布到 PHP 文件)?
谢谢
马特
编辑:对缩进感到抱歉,我比那更整洁,但我责怪 Dreamweaver!:P