2
I own the following Function:
var form = $("#formEditarCompra");
var meioPublicacao = $("#MeioPublicacao").val();
if (form.valid() && setarFocoErro()) {
mostrarAguarde();
$.post(form.attr("action"), { compra: form.serialize(), tipoMeioPublicacao: meioPublicacao }, function(data) {
var result = data;
if (result.Erro) {
mostrarAlerta(result.ErroMsg, 3, "erro");
} else {
mostrarAlerta(result.SucessoMsg, 5);
gridCompra.fnDraw();
}
esconderAguarde();
});
}
And in Controller the following Action:
public ActionResult Editar(Compra compra, string tipoMeioPublicacao);
In the post
I can’t get the two variables to be filled, so it’s in Function, only the typeMeioPublication is filled and the Purchase is null. I tried to use a serialized object as well, as follows:
var compraEditar = {
compra: form.serialize(),
tipoMeioPublicacao: meioPublicacao
}
$.post(form.attr("action"), JSON.stringify(compraEditar), function (data)
This way, the Purchase will be filled, but the typeMeioPublication will null.
How to send everything on post
?
Perfect. Thank you for the reply. ^^
– Jonathan Barcela