Hello, I have been trying to load the content of a single query for days, I have tried both from the server side and directly and both do not work take the same.
I have incorporated the "scroller" plugin but it takes the same, someone can help me, I leave the code here, use php and codeigniter 3.
JS
var table = $('#datatabletransaction').DataTable({
"deferRender": true,
"scrollY": 500,
"scroller": true,
"responsive": true,
"processing": true,
"fixedHeader": true,
"serverSide":true,
"lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "Todos"]],
"ajax": {
"url": mostrarcontenido,
"type": "POST"
},
language": {
"url": "http://cdn.datatables.net/plug-ins/1.10.16/i18n/Spanish.json"
},
"fixedColumns": true,
"iDisplayLength": 5,
"order": [[ 2, "desc" ]]
});
Controller
public function mostrartablatransaccionestelefonos(){
$this->load->model('tablas_model');
$data = array();
$list = $this->tablas_model->mostrar_registros_ventacompra($estado);
foreach ($list as $person) {
$row = array();
$row[] = $person->num_factura;
$row[] = $person->num_albaran;
$row[] = $person->transacion;
$row[] = $person->imei;
$row[] = $person->nombre;
$row[] = $person->fecha_registro;
$row[] = $person->modelo;
$row[] = $person->marca;
$row[] = $person->color;
$row[] = $person->memoria;
$row[] = $person->precio_iva;
$row[] = $person->precio_sin_iva;
$output = array(
"data" => $data,
);
echo json_encode($output);
}