admin管理员组文章数量:1431406
I want to create a form with HTML, that when submitting it will run a javascript function (the function itself needs to contact a local server (localhost:...)), but when inside the javascript function I use window.open(...) a new tab is opened. I want the form to be submitted but not to change the current page, meaning to stay on the form. How do I do that?
I want to create a form with HTML, that when submitting it will run a javascript function (the function itself needs to contact a local server (localhost:...)), but when inside the javascript function I use window.open(...) a new tab is opened. I want the form to be submitted but not to change the current page, meaning to stay on the form. How do I do that?
Share Improve this question asked Nov 6, 2014 at 12:13 user3636583user3636583 1772 gold badges3 silver badges12 bronze badges 1- Possible duplicate of Submit form and stay on same page? – Ciro Santilli OurBigBook. Commented May 30, 2016 at 16:40
2 Answers
Reset to default 2If you are using type="submit"
but want to stay on the same page you could try changing the input type to button so that it would read...
input type="button" value="Submit" onclick="myFunction()"
and in the function call the box variables with...
var name = document.formName.boxName.value;
Set the target
for your form:
<form target="_blank" action="http://example.">.....
本文标签: javascriptHtml submit a formbut stay on the same pageStack Overflow
版权声明:本文标题:javascript - Html submit a form, but stay on the same page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745571161a2664055.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论