Quando tento di recuperare i dati dal mio database al tavolo, ottengo questo errore:Requested sconosciuto parametro '1' dalla sorgente di dati per la riga 0 a DataTable
DataTables warning (table id = 'student_table'): Requested unknown
parameter '1' from the data source for row 0
riportano di seguito le javascript che ho usato
<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>
I dati JSON recuperati:
{"sEcho":0,"iTotalRecords":3,
"iTotalDisplayRecords":3,
"aaData":[["85","t1","1D"],["74","test475","4A"],
["777","maiz","5"]],"sColumns":"id,name,class"}
Qui di seguito è il mio tavolo:
<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>
codice PHP (DataTable accesi)
$this->load->library('datatables');
$this->datatables->select('admission,name,class');
$this->datatables->from('students');
echo $this->datatables->generate();
sto usando CodeIgniter e DataTable.
Perché sto ricevendo quell'errore e come recuperare i dati sul tavolo?
ho provato sia GET che POST ma ottengo lo stesso errore. – LiveEn
L'errore deve essere nella parte php, puoi dimostrarlo? – JvdBerg
ho aggiunto il codice php (datatables ignited) al post principale. – LiveEn