提交表单而不重定向 [英] Submit a Form without redirecting

查看:160
本文介绍了提交表单而不重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提交表单而不重定向页面。表单提交给第三方,所以我不能在PHP中进行更改。
我想要做的是: -

I want to submit a form without redirecting page. Form is submitted to third party so i can't make changes in php. What I want to do is:-


  1. 无需访问第三方页面即可提交。


  1. Submit for without visiting third party page.
  2. After successful submit show alert.

当前我正在使用隐藏的iframe,并将目标隐藏到iframe中,但我并不满意。有没有更好的方法来使用JavaScript或jQuery来做到这一点。

Current I am using hidden iframe and form target to hidden iframe but I am not satisfied. Is there is any better way to do this using javascript or 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: -

My Iframe:-

<iframe style="display:none" id="iframe"></iframe>


推荐答案

更改iframes id 属性为名称

Change the iframes id attribute to name:

<iframe style="display:none" name="iframe"></iframe>

这篇关于提交表单而不重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆