我有六个字段和一个搜索按钮的搜索表单。当用户填写表单deatails并单击搜索按钮时,我需要使用jQuery ajax将表单字段值作为json发送到服务器。如何获取表单字段值并将其作为json使用ajax发送到服务器jquery
然后服务器将发送搜索值并返回响应,然后我需要在ui中填充这些valuse。我需要为jquery ajax提供示例UI代码。请任何人都可以帮忙吗?下面 是我的HTML表单
<form name="NAME" id="customerDetailSearchForm" action="">
<fieldset>
<legend>Search Contact</legend>
<table width="100%" cellpadding="0" cellspacing="0" class="vzuui-detailpanel">
<tr>
<td><label>Name :</label><input type="text" value="" /></td>
<td><label>City :</label><input type="text" value="" /></td>
<td><label>Phone :</label><input type="text" value="" /></td>
</tr>
<tr>
<td><label>Address :</label><input type="text" value="" /></td>
<td><label>State Prov :</label><input type="text" value="" /></td>
<td><label>Email :</label><input type="text" value="" /></td>
</tr>
</table>
</fieldset>
<button class="vzuui-btn-red-active closeedit" type="button" id="search">Search</button>
'$( '#customerDetailSearchForm')。序列化()'会抓住所有的'data'从'form' – Rayon
jQuery的。 com将 – pathfinder
$('#customerDetailSearchForm')。serialize()存储到单个变量并发送到服务器 –