Hello,
I have copied the three files from google's example "Populating Data Using
Server-Side Code" under "Connecting Your DataBase" (i.e.,
exampleUsingPHP.html, getData.php and sampleData.json) to my server but I'm
having trouble getting the chart to display.
It displays OK if I run getData.php from my browser's address bar (Firefox
11.0 and MacBook) and then copy and paste the json it echos from the screen
directly into exampleUsingPHP.html as shown below:
var jsonData = { "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}]} ] };
BTW, Google DO NOT show a semi colon after the last curly bracket in their
json example file (sampleData.json) and the chart won't display without it.
So, I think my problem lies with the following ajax function:
var jsonData = $.ajax({
url: "getData.php",
dataType:"json",
async: false
}).responseText;
I have read through the JQUERY documentation for jQuery.ajax() but can't
find anything wrong. Also, I thought maybe ajax didn't like spaces in its
json but manually deleting them from sampleData.json didn't help.
Now, I have run out of ideas and would greatly appreciate any help.
David Harden
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/bl8SHhwJtdUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.