When I try to retrieve data from my database to the table, I get this error:
DataTables warning (table id = 'student_table'): Requested unknown
parameter '1' from the data source for row 0
Below is the javascript that I used
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#student_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
"sAjaxSource": "<?php echo base_url()?>index.php/data/all"
} );
} );
</script>
The JSON data retrieved:
{"sEcho":0,"iTotalRecords":3,
"iTotalDisplayRecords":3,
"aaData":[["85","t1","1D"],["74","test475","4A"],
["777","maiz","5"]],"sColumns":"id,name,class"}
Below is my table:
<table class="datatable tables" id="student_table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Class</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dataTables_empty">Loading data from server</td>
</tr>
</tbody>
</table>
PHP code (ignited datatables)
$this->load->library('datatables');
$this->datatables->select('admission,name,class');
$this->datatables->from('students');
echo $this->datatables->generate();
I'm using codeigniter and DataTables.
Why am I getting that error and how to retrieve the data to the table?