My controller action with two parameters is never called. Can anyone see what I'm doing wrong?
URL: /api/JobTitle/1/55 (The arguments are 1 and 55.)
ROUTE:
config.Routes.MapHttpRoute(
name: "With2Ids",
routeTemplate: "api/{controller}/{oldDescription}/{newDescription}"
);
(The parameters are oldDescription and newDescription.)
CONTROLLER:
[HttpPost]
public HttpResponseMessage UpdateJobTitle(string oldDescription, string newDescription)
{...
(The parameters match those in the route.)
CALL FROM VIEW:
$.ajax({
url: updateUrl,
type: 'POST',
success: function (result) {
window.location = "/Views/index.html";
}
});
=========================
I've added a custom route with two parameters with the same names as the controller-action parameters. But it never gets called. Any idea why? Thanks!