简体   繁体   English

链接到在新窗口中打开结果的POST数据?

[英]Link to POST data that opens the result in a new window?

I have this link that makes a GET call to a controller method and opens the result in a new window: 我有这个链接,该链接对控制器方法进行GET调用,并在新窗口中打开结果:

@Html.ActionLink("My link text", "MyAction", "MyController", new {myData= Model.SomeField}, new { target= "_blank"})

It works but adds ?myData=xyz to query string. 它有效,但是将?myData = xyz添加到查询字符串。 I want to convert this to a POST call so that myData will no longer be seen in the URL. 我想将其转换为POST调用,以便myData将不再出现在URL中。 How can I do that? 我怎样才能做到这一点? Razor or javascript/jquery is fine as long as it works. Razor或javascript / jquery可以正常使用。 I should also mention that there is already a form on the page, so I can't put the link in a form. 我还应该提到页面上已经有一个表单,因此无法将链接放入表单中。

@using (Html.BeginForm("MyAction", "MyController"))
{
    @Html.HiddenFor(o => Model.SomeField)
    <input type="submit" value="Post" />
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM