I have seen and implemented the code provided using the guide provided
here: https://developers.google.com/chart/interactive/docs/php_example
However, I want to pass back 2 JSON arrays of data for 2 separate tables in
one call and then split and use in each table.
Problem is - I can get the data back into the page but I can't seem to
split and use the actual data - I just keep getting 'undefined' whenever I
try and access it
How can I split the data into 2 separate dataSets and use them individually
in 2 separate DataTables?
e.g. sampleData.json File
{ {
"cols": [
{"id":"","label":"Topping","pattern":"","type":"string"},
{"id":"","label":"Slices","pattern":"","type":"number"}
],
"rows": [
{"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]},
{"c":[{"v":"Onions","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Olives","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]}
]
}, {
"cols": [
{"id":"","label":"Topping","pattern":"","type":"string"},
{"id":"","label":"Slices","pattern":"","type":"number"}
],
"rows": [
{"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]},
{"c":[{"v":"Onions","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Olives","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]},
{"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]}
]
}
}
e.g. *Request*
var jsonData = $.ajax({
url: "getData.php",
dataType: "json",
async: false
});
console.log(jsonData[0]); //undefined
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/ef69d9f5-a05e-42af-8e96-6804f48da3f7%40googlegroups.com.