DataTables warning: table id=divTabla - Invalid JSON respon

DataTables warning: table id=divTabla - Invalid JSON respon

EvilSoulEvilSoul Posts: 1Questions: 1Answers: 0
edited April 2016 in Free community support

when I start my project sends the following error message - DataTables warning: table id=divTabla - Invalid JSON respon

My php code:

<?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.']}';
?>

I will be grateful to receive your help.

Regard.

Evil from Chile

Answers

  • allanallan Posts: 61,892Questions: 1Answers: 10,144 Site admin

    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

This discussion has been closed.