Basically, I have these 2 actions:
[HttpPost]
[ActionName("ListarTodosGrupo")]
public ActionResult ListAllFromGroup(string wildcard = "", int registries = 10)
{
// ...
}
[HttpPost]
[ActionName("ListarTodosGrupo")]
public ActionResult ListAllFromGroup(string cnpj, string wildcard = "", int registries = 10)
{
// ...
}
These actions are supposed to be called from an Ajax call. What I am trying to do is to call different actions depending on the Ajax call arguments (data). Eg:
$.ajax({
url: "/Cliente/ListarTodosGrupo",
type: "post",
dataType: "json",
cache: true,
data: { // This should fire the first action
wildcard: $("input#nomeCliente").val(),
registries: 10
},
...
});
$.ajax({
url: "/Cliente/ListarTodosGrupo",
type: "post",
dataType: "json",
cache: true,
data: { // This should fire the second action
wildcard: $("input#nomeCliente").val(),
registries: 10,
cnpj: '02696818000116'
},
...
});
However, it is not working (only the first action is triggered, despite the number of given params). Is it even possible? How can I do this?