I have run in to a problem with an ajax.actionlink
My code is:
@Ajax.ActionLink("Delete", "DeleteCategory", new { id = item.ID }, new AjaxOptions
{
HttpMethod = "POST",
OnFailure = "function() { alert('fail'); }",
OnSuccess = "function() { alert('success'); }"
})
and the controller is
[HttpPost]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteCategory(int id)
{
categoryBLL.DeleteCategory(id);
return RedirectToAction("CreateCategory");
}
But for some reason I can not get it to work, it doesn't get triggered...
It only redirects to /DeleteCategory/Delete/{id}
Instead of just posting to the controller, and carrying that out..
What am I doing wrong here?