When i use this (valid) XML :
{"cols":[{"id":"task", "type":"string"},{"id":"val", "type":"number"}],"rows": [{"task":"Work", "val":"1"},{"task":"study", "val":"5"},{"task":"eat", "val":"3"},{"task":"nap", "val":"1"}]}
i get client side error: "Cannot read property '1' of undefined".
I thought maybe it is the quotes.. but i get the same above error when i try:
{"cols":[{"id":"task", "type":"string"},{"id":"val", "type":"number"}],"rows": [{"task":"Work", "val":1}]}
My mainline processing code is:
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "getjson.jsp",
dataType:"json",
async: false,
legend:{position: 'labeled'}
}).responseText;
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(jsonData);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.Histogram(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240});
}
</script>