Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

Message error with json

$
0
0

Hi datatable sayme this DataTables warning: table id=DataTables_Table_1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1 when i charge this data

public function mostrarTablaAreas()
{

        $item = null;
        $valor = null;

        $areas = ControladorArea::ctrMostrarArea($item, $valor);

        if (count($areas) == 0) {

            echo '{"data"}: []}';

            return;

        }
        $datosJson = '{

            "data": [';

        for ($i = 0; $i < count($areas); $i++) {

            $botones = "<div class='btn-group'><button class='btn btn-warning btn-sm btnEditarArea' idArea='" . $areas[$i]["ID_Area"] . "' data-toggle='modal' data-target='#modalEditarArea'><i class='fas fa-pencil-alt text-white'></i></button><button class='btn btn-danger btn-sm btnEliminarArea' idArea='" . $areas[$i]["ID_Area"] . "'><i class='far fa-trash-alt'></i></button></div>";
            $datosJson .= '[
                    "' . $areas[$i]["ID_Area"] . '",
                    "' . $areas[$i]["nombreArea"] . '",
                    "' . $botones . '"
                ],';
        }
        $datosJson = substr($datosJson, 0, -1);
        $datosJson .= ']
    }';
        echo $datosJson;
    }

Correctly table should say no data available but i have that error pls help me


Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>