Sometimes, we want to submit an HTML form without redirection.
In this article, we’ll look at how to submit an HTML form without redirection.
How to submit an HTML form without redirection?
To submit an HTML form without redirection, we can redirect to an invisible iframe.
For instance, we write
<iframe name="dummyframe" id="dummyframe" style="display: none"></iframe>
<form action="submitscript.php" target="dummyframe">...</form>
to add a hidden iframe with
<iframe name="dummyframe" id="dummyframe" style="display: none"></iframe>
And then we set the form’s target
attribute to the ID of the hidden iframe to redirect to it after form submission is done.
Conclusion
To submit an HTML form without redirection, we can redirect to an invisible iframe.