我一直在寻找这个.我得到了解决方案.在这里.它是在php中使用AJAX完成的.我有两个页面是googleapi.php和其他getData.php,它是由googleapi.php发送的AJAX请求使用的.
googleapi.php
<html>
<head>
<!--Load the Ajax API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
//google.setOnLoadCallback(drawChart);
function drawChart(object) {
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(object);
var options = {
title: 'Test API',
is3D: 'true',
width: 200,
height: 100
};
// Instantiate and draw …Run Code Online (Sandbox Code Playgroud)