I am using this documentation as a sample reference -> https://preview.keenthemes.com/html/metronic/docs/general/datatables/server-side
My datatables is loading continuously without showing results. I suspect I wrongly code the followings in datatables.php:
public function getJsonDecode(): mixed
{
return json_decode(file_get_contents('apps/map/v2/data_fetch.php'), true);
}
my json data is in apps/map/v2/data_fetch.php coded as follows:
<?php
/* Connection to Database */
include('../connection/config.php');
$select_stmt = $dbh->prepare("SELECT * FROM tbl_map LIMIT 100");
$select_stmt->execute();
$row = $select_stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($row, JSON_UNESCAPED_UNICODE)
?>
Seeking help on what did I do wrong?
Hi,
Sorry for the late reply.
Have you debugged your server-side code and checked its output? By right your response should follow the Datatable server-side response structure as explained in the plugin's official docs here.
Here you can check the server-side response structure requirements that you will need to follow in order to render the datatable records properly when you receive the server-side data.
Can you please provide a test URL to your page so we can check your backend script response for the database data source query?
Regards.