dataTable displays only one row from ajax call
dataTable displays only one row from ajax call
Sigal
Posts: 8Questions: 1Answers: 0
Hello,
I am creating a dataTable with AJAX.
Unfortunatly the site is on my local machine and I can't upload it to a live server yet.
AJAX returns 2 rows from the database yet the table displays only one row.
I tried to use the dataTable debugger link, but I get a message: dataTables is not available on this page.
I am calling the dataTable like this:
[code]$('#logsTbl').dataTable({
"bProcessing": true,
"bDestroy": true,
"sAjaxSource": "/modules/logs/ajax/list_logs.ajax.php?target_id=" + target_id,
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": false },
{ "bSortable": false }
],
"bJQueryUI": true,
"bSortClasses": false,
"sPaginationType": "full_numbers"
});[/code]
The json string I get back from the AJAX call looks like this:
[code]{"found":1,"aaData":[["2013-09-30 11:01:41","adrianB","EVENT_TYPE_USER","Question created: asfasfdasfd","Create New Question","","2013-09-30 11:01:34","adrianB","EVENT_TYPE_USER","Question created: asdfasfd","Create New Question",""]]}[/code]
The table displays only the first row from the json string.
Can someone please help?
I am creating a dataTable with AJAX.
Unfortunatly the site is on my local machine and I can't upload it to a live server yet.
AJAX returns 2 rows from the database yet the table displays only one row.
I tried to use the dataTable debugger link, but I get a message: dataTables is not available on this page.
I am calling the dataTable like this:
[code]$('#logsTbl').dataTable({
"bProcessing": true,
"bDestroy": true,
"sAjaxSource": "/modules/logs/ajax/list_logs.ajax.php?target_id=" + target_id,
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": false },
{ "bSortable": false }
],
"bJQueryUI": true,
"bSortClasses": false,
"sPaginationType": "full_numbers"
});[/code]
The json string I get back from the AJAX call looks like this:
[code]{"found":1,"aaData":[["2013-09-30 11:01:41","adrianB","EVENT_TYPE_USER","Question created: asfasfdasfd","Create New Question","","2013-09-30 11:01:34","adrianB","EVENT_TYPE_USER","Question created: asdfasfd","Create New Question",""]]}[/code]
The table displays only the first row from the json string.
Can someone please help?
This discussion has been closed.
Replies
DataTables is not available on this page
Something was wrong with my ajax file, and something maybe was stuck in the cached.
Changed my ajax file, restarted my computer and now everything works.