3
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
, and yes the action Index
, I mean, it goes to the wrong action. Someone who’s been through this could help me: