DataTable usage in a jquery container with 10 small different widgets. Need help on this
DataTable usage in a jquery container with 10 small different widgets. Need help on this
Hello Friends,
I have a main container page, where I have 10 different small scripts, where I am showing different information. I want to use DataTable for one of this script. I tried but getting some problem in it. What I did was, I created script, where I have kept below code.
[code]
var arrData = new Array();
function loadData()
{
$.ajax({
type: "POST",
url: "sample.php",
data: "&searchkw="+searchkw+"&site="+siteid,
success:
function(msg)
{
arrData = msg;
$('#example').dataTable( {
"aaData": arrData,
"aoColumns": [
{ "sTitle": "Domain" },
{ "sTitle": "Count" }
]
} );
}
}
loadData();
[/code]
My PHP scripts returns data like (as the DataTable takes a static array) :
[['www.google.com',143],['www.yahoo.com',77],['www.google.fr',45],['www.google.de',21],['www.google.es',19],['www.google.com.br',19],['www.google.com.tr',19],['www.google.com.mx',17],
['www.google.ca',15],['www.google.it',15],['www.google.co.uk',8],['www.google.com.ar',7],['www.google.be',6]]
But, I am getting an error as under.
DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0
Can anybody help and tell what am I doing wrong, and where?
Thanks !!
Varsh
I have a main container page, where I have 10 different small scripts, where I am showing different information. I want to use DataTable for one of this script. I tried but getting some problem in it. What I did was, I created script, where I have kept below code.
[code]
var arrData = new Array();
function loadData()
{
$.ajax({
type: "POST",
url: "sample.php",
data: "&searchkw="+searchkw+"&site="+siteid,
success:
function(msg)
{
arrData = msg;
$('#example').dataTable( {
"aaData": arrData,
"aoColumns": [
{ "sTitle": "Domain" },
{ "sTitle": "Count" }
]
} );
}
}
loadData();
[/code]
My PHP scripts returns data like (as the DataTable takes a static array) :
[['www.google.com',143],['www.yahoo.com',77],['www.google.fr',45],['www.google.de',21],['www.google.es',19],['www.google.com.br',19],['www.google.com.tr',19],['www.google.com.mx',17],
['www.google.ca',15],['www.google.it',15],['www.google.co.uk',8],['www.google.com.ar',7],['www.google.be',6]]
But, I am getting an error as under.
DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0
Can anybody help and tell what am I doing wrong, and where?
Thanks !!
Varsh
This discussion has been closed.