Home > Web Front-end > JS Tutorial > body text

js implements not re-refreshing the current page after form submission

高洛峰
Release: 2016-12-03 14:03:44
Original
1578 people have browsed it

How to prevent the current page from being refreshed after submitting the form

<form name=&#39;form1&#39; id=&#39;form1&#39; action=&#39;/xbcw/cw/xx_xx.action&#39; method=&#39;post&#39;>
  <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>
Copy after login

When I click Save to submit the FORM form, how can I keep the current page unchanged (that is, not refresh the current page)?

Add an iframe after the FORM form

 

Click Save In the submission event, you need to change the target to the name of the iframe: JS: document.forms[0].target="rfFrame"; );

In this way, the FORM is submitted and the data is saved, and the page will not jump.

Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template