MVC Ajax.ActionLink doesn't find POST method
Posted
by fearofawhackplanet
on Stack Overflow
See other posts from Stack Overflow
or by fearofawhackplanet
Published on 2010-06-14T11:44:08Z
Indexed on
2010/06/14
12:02 UTC
Read the original article
Hit count: 732
I have a POST method declared in my controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateComments(int id, string comments)
{
// ...
}
and an ActionLink in my view:
<%= Ajax.ActionLink("update", "UpdateComments",
new { id = Model.Id, comments = "test" },
new AjaxOptions {
HttpMethod="POST",
OnFailure="alert('fail');",
OnSuccess = "alert('success');"
})%>
I get a "not found" error when it tries to route this request.
If I remove the POST restriction from the UpdateComments method in the controller, it works fine.
What am I missing?
© Stack Overflow or respective owner