Request.JSON
sending a JSON request to the jsFiddle backend.
Later on parse and display the data.
HTML
<!-- DataTables -->
<body>
<div class="container">
<table id="example" class="display" width="100%">
<thead>
<tr>
<th>name</th>
<th>phone</th>
<th>aliases</th>
</tr>
</thead>
</table>
</div>
</body>
CSS
body {
font-family: Helvetica, Sans, Arial;
}
p, ul {
padding: 10px;
}
ul {
margin: 5px;
border: 2px dashed #999;
}
JavaScript
var table = $('#example').DataTable({
"processing": true,
"ajax": {
"url": "/echo/json/",
"type":"POST",
dataSrc: "",
data: {
json: JSON.stringify([{
name: 'sample',
phone: 'xxx-xxx-xxxx',
aliases: {
alias: 'another text',
test: [3, 2, 'one'],
result: {}
}
}])
}
},
"columns":[
{"data":"name"},
{"data":"phone"},
{"data":"aliases.alias"}
]
});