I am returning a list of data of an object type (GAR) of the actualizarGARs
function of the controller:
var listaGARTratadas = db.GAR.ToList();
return Json(listaGARTratadas);
And in javascript I wanted to send this list of objects back to another function ( carregaGARsCriadas
):
$.getJSON("/GAR/actualizarGARs", { carimbo: carimbo, CaixaFisicaGAR: $("#CaixaFisicaGAR").val() },
function (result) {
$("#divListagemGARActualizadas").empty();
$("#divListagemGARActualizadas").load("/GAR/carregaGARsCriadas", {garsCriadas: result});
}
Where do I get this list of objects passed in result
:
public ActionResult carregaGARsCriadas(List<GAR> garsCriadas) {
return PartialView("listaGARsCriadas");
}
The problem is that I get the garsCriadas
variable with the correct number of elements in the object (for example 5), but the content of each element is null