I'm trying to use the ajax response as an argument for the function drawing the chart with google charts.
This is the JS code:
data.addRows([['One', 5], ['Two', 2]]);
As you can see, the argument contains a couple of square brackets with the "chart's unit" name and its value. Everything works. However when I pass ajax responseText as the argument, it doesn't work at all.
data.addRows(xmlhttp.responseText);
The PHP code returns json_encode($value), where the $value variable is this string: [[one, 5], [two, 2]]
So as the result I get:
"[['one', 5], ['two', 2]]"
BTW. I also tried removing double quotes from the string in the JS code - still no results.
What's wrong? The firebug gives me some strange errors: Argument given to addRows must be either a number or an array...
How should I fix this?