Jquery 在不离开页面的情况下发送表单
我正在使用jQuery覆盖一个分区,其中包含一个小表单,但表单处理的方式是将用户从页面中送出,我只是想知道需要添加什么才能使其调用脚本,发送信息但不离开页面,并在关闭前在div中显示一条小的感谢消息 以下是我对div的编码,包括表单:Jquery 在不离开页面的情况下发送表单,jquery,ajax,forms,Jquery,Ajax,Forms,我正在使用jQuery覆盖一个分区,其中包含一个小表单,但表单处理的方式是将用户从页面中送出,我只是想知道需要添加什么才能使其调用脚本,发送信息但不离开页面,并在关闭前在div中显示一条小的感谢消息 以下是我对div的编码,包括表单: <script> jQuery(document).ready(function() { jQuery ("a[rel]").overlay({mask: {color: '#000', loadSpeed: 200,opacity: 0.5},
<script>
jQuery(document).ready(function() {
jQuery ("a[rel]").overlay({mask: {color: '#000', loadSpeed: 200,opacity: 0.5}, top: '25%',} );
});
</script>
<div class="home-block">
<div class="home-block-content">
<div class="home-block-col1">
<h2>call us</h2>
why not call our friendly designers or let us call you... <span class="callus">0845 6808107</span><br>
<a href="#" rel="#callback" class="simpledialog">request a call back</a></div>
<div class="home-block-col2"><a href="#" rel="#callback" class="simpledialog"><img src="{{skin url=""}}images/media/callus.png" border="0" alt="call us" /></a></div>
</div>
<div class="clear-block"><br>
</div>
</div>
<div class="simple_overlay" id="callback"> Please enter your details and we will call you back...<br />
<br />
<form id="form" name="form" method="post" action="forms/callbackscript.php">
<div class="callback-label">Name:</div>
<div class="callback-field">
<input name="name" type="text" size="25" class="callback-input"></div><div class="clear-block"></div>
<div class="callback-label">Phone Number:</div>
<div class="callback-field">
<input name="phone" type="text" size="25" class="callback-input"></div><div class="clear-block"></div>
<div class="callback-label">Callback time*:</div>
<div class="callback-field">
<select name="howsoon" class="callback-select">
<option value="ASAP">As soon as possible</option>
<option value="AM">AM</option>
<option value="PM">PM</option>
</select></div><div class="clear-block"></div>
<div class="callback-label">Your Question:</div>
<div class="callback-field">
<textarea name="question" cols="27" rows="3" class="callback-input"></textarea><div class="clear-block"></div>
</div>
<div class="callback-label"></div><div class="callback-field">
<input type="submit" name="Submit" value="Submit" />
</form></div><div class="clear-block"></div>
<div class="note">*Please note we can only call back between the hours of 8-5 Monday-Friday and 9-1 on Saturday</div>
<div class="clear-block"></div>
</div>
jQuery(文档).ready(函数(){
覆盖({mask:{color:'#000',加载速度:200,不透明度:0.5},顶部:'25%,});
});
打电话给我们
为什么不打电话给我们友好的设计师或者让我们打电话给你。。。0845 6808107
请输入您的详细信息,我们会给您回电话……
姓名:
电话号码:
回拨时间*:
尽快
是
颗粒物
你的问题:
*请注意,我们只能在周一至周五8-5点和周六9-1点之间回电
以下是forms/callbackscript.php文件的内容:
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$question = $_POST['question'];
$howsoon = $_POST['howsoon'];
$headers = "Content-Type: text/plain; charset=iso-8859-1\n";
$headers .= "From: $name";
$recipient = "sales@ouremailaddress.com";
$subject = "Callback request";
$email_body = "
Name: $name
Phone: $phone
Preferred Time: $howsoon
-------------------
Message and/or Details: $question ";
mail($recipient, $subject, $email_body, $headers);
?>
我假设它将是某种ajax函数,但目前jQuery的学习曲线仍然很陡峭!任何帮助都将不胜感激 你可以很容易地找到你要找的东西