(如何)我可以在新窗口中打开表单提交的结果吗?

时间:2023-01-22 00:01:28

I have a small form inside a table. POSTing that form creates a new entity. I then want users to see that new entity, but it should open in a new window so that the original view isn't lost.

我在桌子里面有一个小表格。发布该表单会创建一个新实体。然后我希望用户看到新实体,但它应该在新窗口中打开,以便原始视图不会丢失。

(How) can I open the result of the form submission in a new window?

(如何)我可以在新窗口中打开表单提交的结果吗?

2 个解决方案

#1


5  

<form ... target="windowName">

or

<form ... target="windowName" onsubmit="window.open(this.action, this.target, '...attributes...');return true;">

...attributes... can consist of the stuff documented at the mozilla developer center or MSDN

...属性...可以包含mozilla开发人员中心或MSDN中记录的内容

#2


0  

One request, one response. That is the way of the web.

一个请求,一个响应。这就是网络的方式。

If you want a new window after a post, you either need to post the request from the new window in the first place- perhaps opened via javascript- or post your data from that page to the same page and save a token so that when the page re-loads is can open a new windows -again, likely with javascript- and that new window's request already knows about the previous post.

如果你想在帖子后面有一个新窗口,你需要首先从新窗口发布请求 - 也许是通过javascript打开 - 或者将你的数据从该页面发布到同一页面并保存一个令牌,这样当页面重新加载是可以打开一个新的窗口 - 可能与javascript-并且新窗口的请求已经知道上一篇文章。

#1


5  

<form ... target="windowName">

or

<form ... target="windowName" onsubmit="window.open(this.action, this.target, '...attributes...');return true;">

...attributes... can consist of the stuff documented at the mozilla developer center or MSDN

...属性...可以包含mozilla开发人员中心或MSDN中记录的内容

#2


0  

One request, one response. That is the way of the web.

一个请求,一个响应。这就是网络的方式。

If you want a new window after a post, you either need to post the request from the new window in the first place- perhaps opened via javascript- or post your data from that page to the same page and save a token so that when the page re-loads is can open a new windows -again, likely with javascript- and that new window's request already knows about the previous post.

如果你想在帖子后面有一个新窗口,你需要首先从新窗口发布请求 - 也许是通过javascript打开 - 或者将你的数据从该页面发布到同一页面并保存一个令牌,这样当页面重新加载是可以打开一个新的窗口 - 可能与javascript-并且新窗口的请求已经知道上一篇文章。