I managed to get it working.In the ajax call, instead of referencing the
php file I referenced the json file directly. I also included the following
script
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
it's working now.
On Friday, 19 October 2012 12:41:56 UTC+2, Kevin Regan wrote:
>
> Hi,
>
> I'm trying to use an external file as an input to a Google Chart in
> sharepoint. After some research I found a reasonably simple way to do this:
> https://developers.google.com/chart/interactive/docs/php_example
>
> The example uses an ajax call to a php file to return json file data.
>
> I saved the php file and sampleData.json file to a location on the
> sharepoint. The php file simply says:
>
> $string =
> file_get_contents("https://etc/etc.../Shared%20Documents/scripts/sampleData.json");
> echo $string;
>
>
> In my drawChart function I set the url parameter to the location of the
> php file as below. However, the chart is not drawn. Am I doing something
> obviously wrong? I think it may be the url parameter? Any ideas?
>
>
> function drawChart() {
> var jsonData = $.ajax({
> url: "https://etc/etc//Shared%20Documents/scripts/getData.php",
> dataType:"json",
> async: false
> }).responseText;
>
> // Create our data table out of JSON data loaded from server.
> var data = new google.visualization.DataTable(jsonData);
> }
>
> Thanks
> K
>
>
--
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/-/zFjg1uczOIIJ.
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.