我想提交表单而不重定向页面。表单已提交给第三方,因此我无法在 php.ini 中进行更改。 我想做的是:-
- 无需访问第三方页面即可提交。
- 成功提交后显示提醒。
目前我正在使用隐藏的 iframe 和表单目标来隐藏 iframe,但我不满意。有没有更好的方法使用 javascript 或 jquery 来做到这一点。
我的表格:-
<form target="iframe" action="http://www.example.com" type="post" id="myform">
<input type="text" value="" name="name">
<input type="submit" name="submit">
</form>
我的 iframe:-
<iframe style="display:none" id="iframe"></iframe>
最佳答案
您需要使用 Ajax 来处理此类请求。
请看一些教程,例如 http://www.w3bees.com/2013/08/submit-form-without-page-refresh-with.html
关于javascript - 提交表单而不重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20813627/