Pregunta

i need to pass a list of object to View from controller using Json , what the syntax of java-script to access the list objects and its properties then add them into data table ?

No hay solución correcta

Otros consejos

In Controller You need use anonymous object to return json data

var result = // object which contain result
var jsonData = result.select(x=>new{
   PropertyA = x.A,
   PropertyB = x.B,
   PropertyC = x.C,
});

return Json(jsonData, JsonRequestBehavior.AllowGet)

In function javascript

success:function(data){
 $.each(data,function(i,data){
    //loop and insert your table
    data.PropertyA //get data  
})
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top