I am new to jquery datatables. I have a json format returning from the server in the below format:
{
"links": [
{
"rel": "self",
"href": "http://hostname:port/state/city/1"
}
],
"name1": "value1",
"name2": "value2",
"name3": "value3",
"name4": "value4"
}
In the javascript I am using the below code to display in the table:
<script>
$(function () {
$('#dataTable').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "partials/records.txt",
"aoColumns": [
{ "mData": "name1" },
{ "mData": "name2" },
{ "mData": "name3" },
{ "mData": "name4" },
]
});
});
</script>
I am getting error and the data is not getting displayed in the table. How to display the above json format in the datatable? To my limited knowledge, I see that I do not have "sAjaxDataProp": "list",
in the script? Is the error because of the sAjaxDataProp
property?
Please let me know where I am going wrong.