I am having some trouble updating a Flot bar chart from an Ajax request to a PHP script that returns JSON data.
The PHP script is:
$vars = array(
'result' => "success",
'msg' => AJAX_SUCCESS,
'series' => "Group One,80,Group Two,10"
);
echo json_encode($vars);
This is returned to a variable 'series'
var data = [series.series];
This outputs to the console:
Group One,80,Group Two,10
I also have a commented out variable which is:
//var datatwo = [ ["Group One", 80], ["Group Two", 10] ];
This also outputs to the console
Group One,80,Group Two,10
The actual javascript to create the graph is
$.plot("#group-month-graph", [data], options);
The options are assigned at another location of the script.
Im trying to figure out what Im doing wrong as when I alert the returned data or output it to the console the values are identical, however the returned data will not draw the graph whereas if I use the commented out value it does.
Hope that makes sense. I have cut down the full script as I dont think that the issue lies anywhere else.