Home > Article > Web Front-end > js implements not re-refreshing the current page after form submission
How to prevent the current page from being refreshed after submitting the 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>
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
3fd24ed8386b437cbda9015eab5173f2065276f04003e4622c4fe6b64f465b88
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.