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
new Request.JSON({
url: 'http://fiddle.jshell.net/echo/json/',
data: {
json: JSON.encode({
name: 'sample',
phone: 'xxx-xxx-xxxx',
aliases: {
alias: 'another text',
test: [3, 2, 'one'],
result: {}
}
})
},
}).send();
var table = $('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": {"url": "http://fiddle.jshell.net/echo/json/", "type":"POST"},
"columns":[{"data":"name"}, {"data":"phone"}, {"data":"aliases.alias"}]
});