I have an action that returns a PartialView
[HttpPost]
public ActionResult SelectCidadesPorCodigoUF(int idUF)
{
//It do something and returns a PartialView
}
This action is mapped as follows:
routes.MapRoute(
name: "SelecionarCidades",
url: "SelecionarCidades/{idUF}",
defaults: new { controller = "Regioes", action = "SelectCidadesPorCodigoUF" }
);
Finally I have made an AJAX request to this action:
$.ajax({
type: 'POST',
url: '/Regioes/SelectCidadesPorCodigoUF',
data: { 'idUF': idUF },
dataType: 'html',
cache: false,
beforeSend: function (data) {
},
success: function (data) {
//do something
},
error: function (data) {
//do something
}
});
The problem I have is that this ajax request does not find this action SelectCidadesPorCodigoUF
, but the action Index
, that is, it goes to the wrong action. Someone who has gone through this could help me: