I have a datatable that I\'m converting into a List, serializing it and passing it to my view using a viewmodel.
My viewmodel looks like this:
public
You could directly inject the values into JavaScript:
//View.cshtml
See JSON.parse, Html.Raw
Alternatively you can get the values via Ajax:
public ActionResult GetValues()
{
// logic
// Edit you don't need to serialize it just return the object
return Json(new { Addresses: lAddressGeocodeModel });
}
See jQuery.ajax