MVC Ajax.ActionLink doesn't find POST method

前端 未结 4 1280
终归单人心
终归单人心 2021-02-05 16:17

I have a POST method declared in my controller:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateComments(int id, string comments)
{
    // ... 
}
         


        
4条回答
  •  梦如初夏
    2021-02-05 16:36

    It seems it didn't like the way I was declaring my OnFailure and OnSuccess callbacks. I guess it couldn't parse my AjaxOptions object so was ignoring the HttpMethod="POST" setting.

    I got it working by changing it to:

    OnFailure="function() { alert('fail'); }",
    OnSuccess="function() { alert('success'); }" 
    

提交回复
热议问题