0

Here's my jquery code:

var url = "@Url.Action("Admin", "EditMovie")" + "/" + id;

$.get(url, function (data) {
  alert("Data Loaded: ");
});

And this is my method inside the controller

public ActionResult EditMovie(int id)
{            
    return PartialView("BasicMovieInfo", repository.GetMovieByID(id));
}

I placed a break point inside the EditMovie action, but it is not being hit. Is there any reason for that?

4

1 回答 1

3

你已经得到了相反的参数。见UrlHelper.Action。第一个参数是动作名称,第二个是控制器名称。假设您的控制器被命名AdminController,它应该是:

var url = "@Url.Action("EditMovie", "Admin")" + "/" + id;
于 2013-07-21T19:23:32.640 回答