php如何接受jquery表单序列化后的值
liuyan.html:
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script>
$(function(){
$("[name='sub']").click(function(){
var data=$("[name='form']").serialize();
$.post("liuyan.php",data,function(data){
alert(data);
});
})
})
</script>
<div class="content">
<div class="right_news_content">
<div style="padding:10px;">
<form name="form">
<table>
<tr>
<td class="font_set"><label for="contactName">联系人:</label></td>
<td><input type="text" name="contactName" class="z_cont"> <span class="font_color">*</span></td>
</tr>
<tr>
<td class="font_set"><label for="contactTell">联系电话:</label></td>
<td><input type="text" name="contactTell" id="contactTell" class="z_cont"> <span class="font_color">*</span></td>
</tr>
<tr>
<td class="font_set"><label for="contactqq">QQ:</label></td>
<td><input type="text" name="contactqq" id="contactqq" class="z_cont"></td>
</tr>
<tr>
<td class="font_set"><label for="contactEmail">邮箱:</label></td>
<td><input type="text" name="contactEmail" id="contactEmail" class="z_cont"></td>
</tr>
<tr>
<td class="font_set"><label for="contactTitle">主题:</label></td>
<td><input type="text" name="contactTitle" id="contactTitle" class="z_cont"> <span class="font_color">*</span></td>
</tr>
<tr>
<td class="font_set"><label for="contactContent">内容:</label></td>
<td><textarea name="contactContent" id="contactContent" cols="39 " rows="5" style="border:1px solid #555;" ></textarea> <span class="font_color">*</span></td>
</tr>
<tr>
<td colspan="2" align="center" style="" >
<input name="sub" type="button" value="提交" style="cursor:pointer; font-size:16px; ">
<input type="reset" value="重置" style="cursor:pointer; font-size:16px; margin-left:20px;">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
liuyan.php:
<?php
print_r($_POST['contactName']);
?>
版权声明:若无特殊注明,本文皆为《菜鸟站长》原创,转载请保留文章出处。
本文链接:php如何接受jquery表单序列化后的值 - https://wlphp.com/?post=59