i tried but unable find every time some sort of error comes,please help me out, the json Data:
{ "siteList": [
{ "siteName": "Site1",
"deviceList": [
{ "deviceName": "S1device1", "count": "1" },
{ "deviceName": "S1device2", "count": "2" }
]
},
{ "siteName": "Site2",
"deviceList": [
{ "deviceName": "S2device1", "count": "1" },
{ "deviceName": "S2device2", "count": "2" }
]
},
{ "siteName": "Site3",
"deviceList": [
{ "deviceName": "S3device1", "count": "1" },
{ "deviceName": "S3device2", "count": "2" }
]
}
]
}
I want to show it on the html table using Datatable Here is the html:
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Site Name</th>
<th>Cabinet</th>
<th>Count</th>
</tr>
</thead>
</table>
And the Jquery:
$(document).ready(function() {
$('#example').DataTable( {
"ajax": "user.json",
"columns": [
{ "siteList": "siteName" },
{ "siteList": "deviceList:deviceName" },
{ "siteList": "deviceList:count" },
]
} );
} );
Please help me to do it any help would be highly appreciated Thanks in advance