jquery 提交form表单

这个其实挺简单的,只是一开始我想错了,一开始我打算用jQuery
+
jQuery.form
插件来作,其实没必要的,只须要jQuery插件就能够了。首先,在jsp页面中导入jQuery javascript


<script
type="text/javascript"
src="<%=request.getContextPath()%>/js/jquery-1.4.2.js"></script>而后在jQueryready方法中定义form提交时的动做就能够了,$(document).ready(function()
{ java


//
使用 jQuery 异步提交表单 jquery


$('#editRealMsgForm').submit(function()
{ ajax


jQuery.ajax({ 异步


url:
'editRealMsg.eri', jsp


data:
$('#editRealMsgForm').serialize(), ide


type: "POST", url


beforeSend:
function() spa


{ 插件


$('#submitButton').hide();


$('#editRealMsgImg').show();


},


success: function()


{


$('#editRealMsgImg').hide();


$('#modifyButton').show();


$('#realName').attr("disabled","true");


$('#tel').attr("disabled","true");


}


});


return false;


});


});


如今这个form就绑定好jQuery封装的异步提交
方法了,简单吧!

相关文章
相关标签/搜索