Php Jquery表单插件未提交到流程页面
我有一个使用Jquery表单插件的基本联系人表单。我不能让它提交使用插件。它只有在我向process.php添加一个php include时才会提交 Javascript:Php Jquery表单插件未提交到流程页面,php,jquery,html,ajax,forms,Php,Jquery,Html,Ajax,Forms,我有一个使用Jquery表单插件的基本联系人表单。我不能让它提交使用插件。它只有在我向process.php添加一个php include时才会提交 Javascript: $(document).ready(function() { $("#contact").validate({ submitHandler: function(form) { $(form).ajaxSubmit({ url:"pro
$(document).ready(function() {
$("#contact").validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
url:"process.php",
type:"post",
});
}
});
});
这是我的联系方式:
<form id="contact" method="post" name="validation" action="contact.php" onsubmit="return validateForm();">
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name" title="Enter your name" class="required">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="yourname@domain.com" title="Enter your e-mail address" class="required email">
<label for="phone">Phone</label>
<input type="tel" name="phone" placeholder="ex. (555) 555-5555">
<label for="message">Question/Comment</label>
<textarea name="message"></textarea>
<input type="submit" name="submitted" class="button" id="submit" value="Send Message" />
</fieldset>
</form>
名称
电子邮件
电话
问题/评论
Process.php
<?php
function GetHeaders()
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Company Name<info@companyname.com>' . "\r\n";
return $headers;
}
// Get Data
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$message = strip_tags($_POST['message']);
// Send Message
$headers = GetHeaders();
$intro = "\"Thank you for contacting Company Name. We are very interested in assessing your situation and will be in touch as soon possible.\" <br />
<br/>
Best Regards,<br/>
<br/>
Company<br/>
";
mail($email, "RE: Contact Form Submission", $intro, $headers);
?>
action="contact.php"
感谢您提前提供的帮助。您需要从表单属性中删除
onsubmit=“return validateForm();
。您已经在使用$(“#contact”)进行验证。验证({
在查询就绪函数中
另外,您的表单似乎提交到contact.php,而不是process.php
<?php
function GetHeaders()
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Company Name<info@companyname.com>' . "\r\n";
return $headers;
}
// Get Data
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$message = strip_tags($_POST['message']);
// Send Message
$headers = GetHeaders();
$intro = "\"Thank you for contacting Company Name. We are very interested in assessing your situation and will be in touch as soon possible.\" <br />
<br/>
Best Regards,<br/>
<br/>
Company<br/>
";
mail($email, "RE: Contact Form Submission", $intro, $headers);
?>
action="contact.php"
process.php
的内容是什么?我在上面添加了它,但在使用include(“process.php”)时,它似乎还没有到达process.php;我可以让一切正常工作,但我真的很想弄清楚为什么表单插件不起作用。我还在htmlaction='contact.php'
和ajaxurl:'process.php'
中使用jquery 1.8.0,这让我很困惑Hanks,hsalama——我想插件会覆盖表单上的操作,即contact.php?我不想让用户失望o提交表单后,请转到process.php,我希望他们留在contact.php上