I need to add foreach loop and add model data instead of this hardcoded data. I don't know how to add it inside javascript code with jQuery.
@model IEnumerable<HR.Models.Officials>
@foreach (var item in Model)
{
@Html.DisplayFor(modelItem => item.Id),
@Html.DisplayFor(modelItem => item.parentId),
@Html.DisplayFor(modelItem => item.Name)
}
<script type="text/javascript">
var peopleElement = document.getElementById("people");
var orgChart = new getOrgChart(peopleElement, {
primaryFields: ["name", "title", "phone", "mail"],
photoFields: ["image"],
dataSource: [
{ id: 1, parentId: null, name: "Amber McKenzie", title: "CEO", phone: "678-772-470", mail: "lemmons@jourrapide.com", adress: "Atlanta, GA 30303", image: "images/f-11.jpg" } ]
});
</script>
I need to add a foreach loop with my model and add model instead of this hardcoded data.
For example id:1 = id:@model.id
. I need it in the foreach loop. Kindly need someone to guide me