[英]Submit form and stay on same page with target='_top'
Here is my form on domain1: 这是我在domain1上的表格:
<form id ='myForm' action='domain2' method='GET' target='_top'>
<input type='hidden' name='id' value='00345897'>
<input type='hidden' name='status' value='Success'>
<input type="submit" value="Submit">
</form>
Now when I submit my form it goes to the domain2 as mentioned in the action. 现在,当我提交表单时,它会转到操作中提到的domain2。 Is it possible to get the response back to domain1?
是否可以将响应返回到domain1? I am getting the response if the target attribute is '_self' or if I remove the target attribute.
如果目标属性是“ _self”或删除目标属性,我会得到响应。 But with target='_top' the page is redirected to domain2.
但是使用target ='_ top'时,页面将重定向到domain2。 How can I get the response back to domain1?
如何将响应返回到domain1? Thanks.
谢谢。
The response can't go anywhere other than to the browser making the response. 响应只能传递到浏览器做出响应的任何地方。
If you don't specify a target
, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it). 如果您未指定
target
,那么它将与包含表单的页面显示在同一窗口或框架中(用表单替换页面)。
If you specify target="_top"
then it will appear in the top-level frame replacing that. 如果您指定
target="_top"
,它将出现在顶层框架中,并替换掉它。
If you want to get the data to the site making the request then you need to either: 如果要将数据发送到发出请求的站点,则需要执行以下任一操作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.