$('#tbl_viewalluser').dataTable({
"bJQueryUI": true,
"bSortClasses": false,
"bAutoWidth": true,
"bInfo": true,
"sScrollY": "100%",
"sScrollX": "100%",
"bScrollCollapse": true,
"sPaginationType": "full_numbers",
"bRetrieve": true,
"oLanguage": {
"sSearch": "Search Anything:"
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo site_url('backend/loadUser') ?>",
"fnServerData": function(sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
<table class="display table " id="tbl_viewalluser" >
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Role</th>
<th>Is Locked</th>
<th>Last IP</th>
<th>Last login</th>
<th>Created</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
External resources loaded into this fiddle: