DataTables warning: table id=divTabla - Invalid JSON respon
DataTables warning: table id=divTabla - Invalid JSON respon
when I start my project sends the following error message - DataTables warning: table id=divTabla - Invalid JSON respon
My php code:
```js
<?php
include("conectar.php");
$consultadt = "SELECT idver, fecha_solicitud, solicitado_por, estado_tarea FROM control_versiones";
$registro = odbc_exec($consultadt);
$i=0;
$tabla= "";
while ($row = odbc_fetch_array (registro))
{
$tabla.='{"IDVer":"'.row['idver'].'","Fecha de Solicitud":"'.row['fecha_solicitud'].'","Solicitudado Por":"'row['solicitado_por'].'","Estado de Tarea":"'.row['estado_tarea'].'"},';
$i++;
}
$tabla = substr($tabla,0,strlen($tabla) -1;
echo '{"data":['.$tabla.']}';
<?php
>
```
?>
I will be grateful to receive your help.
Regard.
Evil from Chile
Answers
Hi,
Did you follow the instructions in the tech note that the error message links to? If so, what is the data that is returned from the server - since it isn't valid JSON?
I would strongly encourage you to use
json_encode
to create JSON and don't do it yourself.Allan