I get an variable via ajax from php file
This is data for google column chart
When i use it for build chart - it doesn't work
But same data works fine, when i paste it directly
Here example:
$.get("./get_charts.php", function(data){
//alert(data.daily) = [ ["12.10.2011", 2250],["07.12.2011", 100] ]
drawChart('daily', 'number', 'Kgs', data.daily, 0);
}, "json");
}
function drawChart(ctype, col_type, col_name, cdata, baseline)
{
var data = new google.visualization.DataTable();
data.addColumn('string', 'Date');
data.addColumn(col_type, col_name);
//doesn't work
data.addRows(cdata);
//works fine
data.addRows([ ["12.10.2011", 2250],["07.12.2011", 100] ]);
....
}
I guess it's because this variable is passed as string value, but not array
How to convert it?