0

我有一个 Html.ActionLink 需要发布到服务器:

@Html.ActionLink("Some Text", "controller", "service", Model, new { @class = "btn btn-primary", @id = "someText" })

我试着把它变成一个 AJAX 帖子:

@Ajax.ActionLink("Some Text", "controller", "service", Model, new { @class = "btn btn-primary", @id = "someText" }, new AjaxOptions(){HttpMethod = "POST"})

没有像上面的Html.Actionlink那样的字符串、字符串、字符串、对象、对象的重载。

我对 AJAX 不是很熟悉,但有没有办法告诉 AJAX 传递相同的数据?

4

1 回答 1

1

看起来您的参数顺序不正确。先于AjaxOptions属性。

@Ajax.ActionLink("Some Text", "controller", "service", Model, new AjaxOptions(){HttpMethod = "POST"}, new { @class = "btn btn-primary", @id = "someText" })
于 2012-10-05T19:40:48.427 回答