我有一个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传递相同的数据?
答案 0 :(得分:1)
看起来您的参数排序不正确。 AjaxOptions
位于属性之前。
@Ajax.ActionLink("Some Text", "controller", "service", Model, new AjaxOptions(){HttpMethod = "POST"}, new { @class = "btn btn-primary", @id = "someText" })