Using a variable for sAjaxSource
Using a variable for sAjaxSource
I have been struggling with this problem. I want to use a variable that has a Json. I'm using it like this:
[code]
$(document).ready(function () {
var getlist = '<%=output%>';
$('#datatables').dataTable({
"bProcessing": true,
"sAjaxSource": getlist,
"sAjaxDataProp": "people",
"aoColumns": [
{ "mDataProp": "id_name" },
{ "mDataProp": "name" },
{ "mDataProp": "lastname" },
]
});
I have used alert(getlist) and it displays the Json so I know that is working, but there's no info inside the table. Please, if you know how to solve this, I would appreciated it.
Thanks.
[code]
$(document).ready(function () {
var getlist = '<%=output%>';
$('#datatables').dataTable({
"bProcessing": true,
"sAjaxSource": getlist,
"sAjaxDataProp": "people",
"aoColumns": [
{ "mDataProp": "id_name" },
{ "mDataProp": "name" },
{ "mDataProp": "lastname" },
]
});
I have used alert(getlist) and it displays the Json so I know that is working, but there's no info inside the table. Please, if you know how to solve this, I would appreciated it.
Thanks.
This discussion has been closed.
Replies
If you want to pass data to the table to use during initialisation, use aaData .
Allan