jqeury中ajax的表单实现异步提交
jQuery异步提交form表单
<script type="text/javascript"src="<%=request.getContextPath()%>/js/jquery-1.4.2.js"></script> 然后在jQuery的ready方法中定义form提交时的动作就可以了, $(document).ready(function() { // 使用 jQuery异步提交表单 $('#editRealMsgForm').submit(function() { jQuery.ajax({ url:'editRealMsg.eri', data:$('#editRealMsgForm').serialize(), type:"POST", beforeSend:function() { $('#submitButton').hide(); $('#editRealMsgImg').show(); }, success:function() { $('#editRealMsgImg').hide(); $('#modifyButton').show(); $('#realName').attr("disabled","true"); $('#tel').attr("disabled","true"); } }); returnfalse; }); }); 现在这个form就绑定好jQuery封装的异步提交方法了,简单吧! ===================================================== the secondmethod ======================================================= Jquery来对form表单提交(mvc方案)
Jquery来对form表单提交,下面是一个form表单,里面没有action字段,我们来用Jquery注册事件进行提交,
<form method="post"id="documentForm"> |