I have an AspNet MVC project structured as follows:
Projeto L Areas L Area1 L Controllers L MeuControllerArea1Controller.cs Views Area2 L Controllers L MeuControllerArea2Controller.cs Views L MinhaView.cshtml
In MyControllerArea1 , I have a public method ( MinhaActionArea1 ) that returns a json
, I want to access it from MyView that is in Area2 .
Home
The code below has not worked, because when it runs, it looks for MyActionArea1 in MyControllerArea2 .
function ObterResultado() {
$.post('@Url.Action("MinhaActionArea1", "../Area1/MeuControllerArea1")')
.done(function (data) {
// Código de sucesso...
})
.fail(function () {
// Código de falha...
});
}
Note: I'm using AreaRegistration .