简体   繁体   中英

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:

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

It works but adds ?myData=xyz to query string. I want to convert this to a POST call so that myData will no longer be seen in the URL. How can I do that? Razor or javascript/jquery is fine as long as it works. 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" />
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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