The problem is likely that you are missing jQuery.  The example assumes you 
have a local copy, which you probably don't.  Switch this line:

<script type="text/javascript" src="jquery-1.6.2.min.js"></script> 

to this:

<script type="text/javascript" src=
"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";></script> 

Also, depending on your server settings, you may need to add headers to the 
getData.php file.  If the above change doesn't fix it for you, add these 
lines to getData.php before the "echo $string;" line:

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');

The first two prevent the browser from caching the result and are not 
strictly necessary for this to work, but you will want them if the data is 
likely to change over time.  The third line tells the server and browser 
that this is json, not HTML, and to interpret it appropriately.

On Friday, June 29, 2012 4:46:33 PM UTC-4, Bob Zinc wrote:
>
> https://developers.google.com/chart/interactive/docs/php_example
>
> I am working on a small project to pull in some information from a website 
> and generate some chart.
> However, in beginning, I met some problems: the link above is very clear 
> and I copy to my amazonaws.com server because this code snippet uses PHP 
> to populate a datatable.
> What I did is to create three files 
> exampleUsingPHP.html
> getData.php
> sampleData.jsonand store them into one directory. 
>
> But when I accessed the "exampleUsingPHP.html", no desired result showed 
> up.
>
> I guess something wrong with jQuery function ajax() url, but I cannot 
> figure out where I went wrong.
> Can Somebody help me with this question otherwise I cannot go further on 
> my own project.
>
>
> Thanks a lot!
>

-- 
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/-/SaBKH6hz3XMJ.
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.

Reply via email to