如何便捷的使用jquery来实现form的功能,内详
form表单的提交会带来页面的转跳,用jquery的ajax提交又苦于设置每个表单项的值和名称
有没有便捷的方法来直接获取一个区域内(或者是div,或者是form,或者是table或者其他)的所有各种类型输入框/下拉菜单等所有表单项的name和value然后使用ajax提交
性能损失大不大?合不合算? 有没有更好的办法? jquery form ajax
[解决办法]
本来就这样
http://jqueryvalidation.org/
[解决办法]
<form id="form" runat="server" method="post" action="/Test/StudentSave/" enctype="application/x-www-form-urlencoded">
<table width="100%">
<tr>
<td style="text-align: right; width: 120px;">
学号(<font color="red">*</font>):
</td>
<td>
<input type="text" class="easyui-validatebox" required="true" name="entity.Num"
value="<%= ((dynamic)this.ViewData["entity"]).Num%>" />
</td>
</tr>
<tr>
<td style="text-align: right; width: 120px;">
姓名:
</td>
<td>
<input type="text" class="easyui-validatebox" required="true" name="entity.Name"
value="<%= ((dynamic)this.ViewData["entity"]).Name%>"
</td>
</tr>
</table>
</form>
public ActionResult StudentSave(Student entity)//这里的entity直接拿到Num 、Name
{}
$("form").serialize();single=Single&multiple=Multiple&multiple=Multiple3&check=check2&radio=radio1