标签:点击 pre color ret user use ... span sub
今天发现如果页面中有form,点击提交按钮是会刷新页面的,为了禁止页面刷新行为,可以这么做:
<form class="form-horizontal" id="user" role="form" onsubmit="submitUser(event)"> ...... </form> script // function submitUser(event){ //创建用户 event.preventDefault()||(event.returnValue=false);//阻止表单提交的页面刷新行为 //ajax提交部分代码 }
即阻止form的默认行为就可以了。
标签:点击 pre color ret user use ... span sub
原文地址:http://www.cnblogs.com/yingge/p/6227910.html