How to make a post
sending data to a ActionResult
of a Controller
different from the current%? Example:
I have a link called lnkEnviarDados
and I need to make a post on the page by sending the contents of the variables when I click on this link.
@using (Html.BeginForm("Index", "Pessoa", FormMethod.Post))
{
<table class="grid">
<tbody>
<tr>
<td>
<a href="#" class="lnkEnviarDados" name="downloaditem" id="downloaditem2" data-id_Atributo_1="6" data-id_Atributo_2="1" data-id_Atributo_3="2" target="_blank">
<span class="idSpan">Regular</span>
</a>
</td>
</tr>
</tody>
</table>
}
@section Scripts{
<script type="text/javascript">
$(document).ready(function () {
$(document).on('click', '.lnkEnviarDados', function (e) {
e.preventDefault();
var _Atributo_1 = $(this).attr("data-Atributo_1");
var _Atributo_2 = $(this).attr("data-Atributo_2");
var _Atributo_3 = $(this).attr("data-Atributo_3");
//Fazer um post deste controller para enviar os dados acima
//para um outro Controller chamado "BaixarConta"
});
}
}
CONTROLLER DownloadContact
[HttpPost]
public ActionResult BaixarConta(int _Atributo_3, int _Atributo_2, int _Atributo_3)
{
}