怎么實現form表單提交后不重新刷新當前頁面


怎么實現表單提交后不重新刷新當前頁面

 
 
如何實現表單提交后不重新刷新當前頁面

<form name='form1' id='form1' action='/xbcw/cw/xx_xx.action' method='post'>

  <input type="button" id="btnSubmit" name="btnSubmit" value="保存" onclick="addKp()" class="Button2" />

  <input type="button" id="btnSubmit" name="btnSubmit" value="下一步" onclick="doAddCwKpSubmit()" class="Button2" />

</form>


當我點擊保存提交FORM表單后,如何讓當前頁面維持不變(即不刷新當前頁)?

在FORM表單后添加一個iframe

  <iframe id="rfFrame" name="rfFrame" src="about:blank" style="display:none;"></iframe> 


點保存提交事件里面需要將target改為iframe的名字:

  JS:document.forms[0].target="rfFrame";

JQuery:$("#f2").attr("target","rfFrame");



這樣即提交了FORM保存了數據,頁面也不會跳轉.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM