Datatables Throwing Invalid JSON Response Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Safely turning a JSON string into an objectSerializing to JSON in jQueryHow do I format a Microsoft JSON date?Detecting an “invalid date” Date instance in JavaScriptWhy does Google prepend while(1); to their JSON responses?Convert JS object to JSON stringHow can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?The “right” JSON date formatHow do I return the response from an asynchronous call?

How do I deal with an erroneously large refund?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Why doesn't the university give past final exams' answers?

Married in secret, can marital status in passport be changed at a later date?

Can gravitational waves pass through a black hole?

How would you suggest I follow up with coworkers about our deadline that's today?

What to do with someone that cheated their way though university and a PhD program?

Bright yellow or light yellow?

Is it appropriate to mention a relatable company blog post when you're asked about the company?

How was Lagrange appointed professor of mathematics so early?

What is the evidence that custom checks in Northern Ireland are going to result in violence?

When does Bran Stark remember Jamie pushing him?

Are these square matrices always diagonalisable?

What *exactly* is electrical current, voltage, and resistance?

Was Objective-C really a hindrance to Apple software development?

Was there ever a LEGO store in Miami International Airport?

What's called a person who works as someone who puts products on shelves in stores?

What is the ongoing value of the Kanban board to the developers as opposed to management

How to compute a Jacobian using polar coordinates?

Does Prince Arnaud cause someone holding the Princess to lose?

/bin/ls sorts differently than just ls

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Are there existing rules/lore for MTG planeswalkers?



Datatables Throwing Invalid JSON Response



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Safely turning a JSON string into an objectSerializing to JSON in jQueryHow do I format a Microsoft JSON date?Detecting an “invalid date” Date instance in JavaScriptWhy does Google prepend while(1); to their JSON responses?Convert JS object to JSON stringHow can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?The “right” JSON date formatHow do I return the response from an asynchronous call?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am facing issues with the Datatables plugin while fetching data using SSP. I had used the Custom SSP library, but that is returning an error of Invalid JSON response. Anybody here who has implemented the custom SSP library? I will have to use JOINS, WHERE, GROUP BY, etc. I am also open to suggestions on how to implement a Live Filtering function in tables using PHP as shown in the example table here. So if you guys have any idea on how to implement this without using Datatables, that would also work fine.




DataTables warning: table id=example - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1




Initialisation






< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





The one with the JOIN query. The Custom SSP Library has been used here.






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





This is running fine and has the Datatables SSP file (rep_down_data.php)






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





The HTML code for the table






<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>












share|improve this question
























  • Please post your actual code, not screenshots

    – Darren
    Mar 9 at 5:20











  • @Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

    – arnab1510
    Mar 9 at 5:35











  • Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

    – Bjoern
    Mar 9 at 12:21

















0















I am facing issues with the Datatables plugin while fetching data using SSP. I had used the Custom SSP library, but that is returning an error of Invalid JSON response. Anybody here who has implemented the custom SSP library? I will have to use JOINS, WHERE, GROUP BY, etc. I am also open to suggestions on how to implement a Live Filtering function in tables using PHP as shown in the example table here. So if you guys have any idea on how to implement this without using Datatables, that would also work fine.




DataTables warning: table id=example - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1




Initialisation






< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





The one with the JOIN query. The Custom SSP Library has been used here.






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





This is running fine and has the Datatables SSP file (rep_down_data.php)






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





The HTML code for the table






<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>












share|improve this question
























  • Please post your actual code, not screenshots

    – Darren
    Mar 9 at 5:20











  • @Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

    – arnab1510
    Mar 9 at 5:35











  • Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

    – Bjoern
    Mar 9 at 12:21













0












0








0








I am facing issues with the Datatables plugin while fetching data using SSP. I had used the Custom SSP library, but that is returning an error of Invalid JSON response. Anybody here who has implemented the custom SSP library? I will have to use JOINS, WHERE, GROUP BY, etc. I am also open to suggestions on how to implement a Live Filtering function in tables using PHP as shown in the example table here. So if you guys have any idea on how to implement this without using Datatables, that would also work fine.




DataTables warning: table id=example - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1




Initialisation






< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





The one with the JOIN query. The Custom SSP Library has been used here.






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





This is running fine and has the Datatables SSP file (rep_down_data.php)






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





The HTML code for the table






<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>












share|improve this question
















I am facing issues with the Datatables plugin while fetching data using SSP. I had used the Custom SSP library, but that is returning an error of Invalid JSON response. Anybody here who has implemented the custom SSP library? I will have to use JOINS, WHERE, GROUP BY, etc. I am also open to suggestions on how to implement a Live Filtering function in tables using PHP as shown in the example table here. So if you guys have any idea on how to implement this without using Datatables, that would also work fine.




DataTables warning: table id=example - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1




Initialisation






< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





The one with the JOIN query. The Custom SSP Library has been used here.






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





This is running fine and has the Datatables SSP file (rep_down_data.php)






<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





The HTML code for the table






<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>








< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





< script >
$(document).ready(function()
$('#example').DataTable(
colReorder: true,
"scrollX": true,
"processing": true,
"serverSide": true,
"ajax": "rep_down_data.php"
);
); <
/script>





<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'is_phone_verified', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
array( 'db' => 'rep_code', 'dt' => 5 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require('ssp.customized.class.php' );
$joinQuery = "FROM `t_user` AS `u` JOIN `t_user_course` AS `ud` ON (`ud`.`user_id` = `u`.`id`)";
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery )
);





<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





<?php
$table = 't_user';
$primaryKey = 'id';
$columns = array(
array( 'db' => 'created_at', 'dt' => 0 ),
array( 'db' => 'email', 'dt' => 1 ),
array( 'db' => 'mobile_number', 'dt' => 2 ),
array( 'db' => 'first_name', 'dt' => 3 ),
array( 'db' => 'last_name', 'dt' => 4 ),
);
require('config.php');
$sql_details = array(
'user' => $db_username,
'pass' => $db_password,
'db' => $db_name,
'host' => $db_host
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);





<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>





<section id="column-filtering">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title">Rep Downloads</h4>
<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
<div class="heading-elements">
<ul class="list-inline mb-0">
<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
<li><a data-action="close"><i class="ft-x"></i></a></li>
</ul>
</div>
</div>
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<table id="example" class="display nowrap table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Enr. Date</th>
<th>Email</th>
<th>Mobile Number</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</section>






javascript php jquery mysql datatables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 11 at 12:54









Curr195

1,61331635




1,61331635










asked Mar 9 at 4:30









arnab1510arnab1510

314




314












  • Please post your actual code, not screenshots

    – Darren
    Mar 9 at 5:20











  • @Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

    – arnab1510
    Mar 9 at 5:35











  • Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

    – Bjoern
    Mar 9 at 12:21

















  • Please post your actual code, not screenshots

    – Darren
    Mar 9 at 5:20











  • @Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

    – arnab1510
    Mar 9 at 5:35











  • Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

    – Bjoern
    Mar 9 at 12:21
















Please post your actual code, not screenshots

– Darren
Mar 9 at 5:20





Please post your actual code, not screenshots

– Darren
Mar 9 at 5:20













@Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

– arnab1510
Mar 9 at 5:35





@Darren I have edited the post with the screenshots. Do let me know if anything else is needed.

– arnab1510
Mar 9 at 5:35













Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

– Bjoern
Mar 9 at 12:21





Please inspect your php scripts ajax response with your browser and post it here (at least structurally).

– Bjoern
Mar 9 at 12:21












1 Answer
1






active

oldest

votes


















1














First, off, you don't need to specify column headers within your HTML. You may set those using columns / columnDefs options with title property. That way, you will not see the table with default styling before DataTable gets initialized. Your table markup may simply look like: <table id="example" ...></table>.



But that, of course, is not the root cause of your problem.



What looks suspicious to me is your SQL. It looks like you're referring twice to your t_user table: first time, by setting $table variable, second, with this part of your $joinQuery - FROM
t_user
. So, if you have a chance to throw back the output of the query, say, with var_dump() in the appropriate place of your code, or echo the query itself to check its validity, I guess, that would've give you a hint.



Another thing you must be sure of, is that your SQL output contains the array of arrays or array of objects that correspond to your rows and either of those are encompassed within data / aaData of your output JSON. Otherwise, you may need to specify JSON property that holds your array within ajax.dataSrc option, or set it to empty string if your JSON is an array itself.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073995%2fdatatables-throwing-invalid-json-response%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    First, off, you don't need to specify column headers within your HTML. You may set those using columns / columnDefs options with title property. That way, you will not see the table with default styling before DataTable gets initialized. Your table markup may simply look like: <table id="example" ...></table>.



    But that, of course, is not the root cause of your problem.



    What looks suspicious to me is your SQL. It looks like you're referring twice to your t_user table: first time, by setting $table variable, second, with this part of your $joinQuery - FROM
    t_user
    . So, if you have a chance to throw back the output of the query, say, with var_dump() in the appropriate place of your code, or echo the query itself to check its validity, I guess, that would've give you a hint.



    Another thing you must be sure of, is that your SQL output contains the array of arrays or array of objects that correspond to your rows and either of those are encompassed within data / aaData of your output JSON. Otherwise, you may need to specify JSON property that holds your array within ajax.dataSrc option, or set it to empty string if your JSON is an array itself.






    share|improve this answer





























      1














      First, off, you don't need to specify column headers within your HTML. You may set those using columns / columnDefs options with title property. That way, you will not see the table with default styling before DataTable gets initialized. Your table markup may simply look like: <table id="example" ...></table>.



      But that, of course, is not the root cause of your problem.



      What looks suspicious to me is your SQL. It looks like you're referring twice to your t_user table: first time, by setting $table variable, second, with this part of your $joinQuery - FROM
      t_user
      . So, if you have a chance to throw back the output of the query, say, with var_dump() in the appropriate place of your code, or echo the query itself to check its validity, I guess, that would've give you a hint.



      Another thing you must be sure of, is that your SQL output contains the array of arrays or array of objects that correspond to your rows and either of those are encompassed within data / aaData of your output JSON. Otherwise, you may need to specify JSON property that holds your array within ajax.dataSrc option, or set it to empty string if your JSON is an array itself.






      share|improve this answer



























        1












        1








        1







        First, off, you don't need to specify column headers within your HTML. You may set those using columns / columnDefs options with title property. That way, you will not see the table with default styling before DataTable gets initialized. Your table markup may simply look like: <table id="example" ...></table>.



        But that, of course, is not the root cause of your problem.



        What looks suspicious to me is your SQL. It looks like you're referring twice to your t_user table: first time, by setting $table variable, second, with this part of your $joinQuery - FROM
        t_user
        . So, if you have a chance to throw back the output of the query, say, with var_dump() in the appropriate place of your code, or echo the query itself to check its validity, I guess, that would've give you a hint.



        Another thing you must be sure of, is that your SQL output contains the array of arrays or array of objects that correspond to your rows and either of those are encompassed within data / aaData of your output JSON. Otherwise, you may need to specify JSON property that holds your array within ajax.dataSrc option, or set it to empty string if your JSON is an array itself.






        share|improve this answer















        First, off, you don't need to specify column headers within your HTML. You may set those using columns / columnDefs options with title property. That way, you will not see the table with default styling before DataTable gets initialized. Your table markup may simply look like: <table id="example" ...></table>.



        But that, of course, is not the root cause of your problem.



        What looks suspicious to me is your SQL. It looks like you're referring twice to your t_user table: first time, by setting $table variable, second, with this part of your $joinQuery - FROM
        t_user
        . So, if you have a chance to throw back the output of the query, say, with var_dump() in the appropriate place of your code, or echo the query itself to check its validity, I guess, that would've give you a hint.



        Another thing you must be sure of, is that your SQL output contains the array of arrays or array of objects that correspond to your rows and either of those are encompassed within data / aaData of your output JSON. Otherwise, you may need to specify JSON property that holds your array within ajax.dataSrc option, or set it to empty string if your JSON is an array itself.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 14 at 5:26

























        answered Mar 10 at 7:23









        Curr195Curr195

        1,61331635




        1,61331635





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073995%2fdatatables-throwing-invalid-json-response%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved