Question

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 correct solution

OTHER TIPS

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  
})
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top