Data input
Data input
I figured out how to format json output. However, now I have a problem understanding how to get ajax source.
In my controller i have set a variable that holds a string of formated data:
$json = { "aaData":[["kofefehe905","127.0.0.1","kofefehe905@example.com",991200833,2,"Normal"],["newapigo5813","127.0.0.1","newapigo5813@example.com",991200833,2,"Normal"]] } ;
How do i load it to datatables without echoing it?
This does not work:
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": <?= $this->json ?>
} );
} );
Thanks
In my controller i have set a variable that holds a string of formated data:
$json = { "aaData":[["kofefehe905","127.0.0.1","kofefehe905@example.com",991200833,2,"Normal"],["newapigo5813","127.0.0.1","newapigo5813@example.com",991200833,2,"Normal"]] } ;
How do i load it to datatables without echoing it?
This does not work:
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": <?= $this->json ?>
} );
} );
Thanks
This discussion has been closed.
Replies
$json = '{ "aaData":[["kofefehe905","127.0.0.1","kofefehe905@example.com",991200833,2,"Normal"],["newapigo5813","127.0.0.1","newapigo5813@example.com",991200833,2,"Normal"]] }' ;
This string is a formatted output from a db query.