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;
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>
javascript php jquery mysql datatables
add a comment |
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>
javascript php jquery mysql datatables
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
add a comment |
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>
javascript php jquery mysql datatables
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
javascript php jquery mysql datatables
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
. So, if you have a chance to throw back the output of the query, say, with
t_uservar_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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
. So, if you have a chance to throw back the output of the query, say, with
t_uservar_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.
add a comment |
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
. So, if you have a chance to throw back the output of the query, say, with
t_uservar_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.
add a comment |
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
. So, if you have a chance to throw back the output of the query, say, with
t_uservar_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.
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
. So, if you have a chance to throw back the output of the query, say, with
t_uservar_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.
edited Mar 14 at 5:26
answered Mar 10 at 7:23
Curr195Curr195
1,61331635
1,61331635
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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