我刚刚开始使用带有 PHP 和 MySQL 的 Google Charts API,希望得到一些帮助。我希望 Google Charts 使用的 MySQL 查询的结果基于变量。基本上我有这个,它按预期工作。
显示图表.php
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
            <script type="text/javascript">
                google.load('visualization', '1', { packages: ['corechart'] });
                google.setOnLoadCallback(drawChart);
                function drawChart() {
                   var jsonData = $.ajax({
                        url: "test3.php",
                        dataType: "json",
                        async: false
                    }).responseText;
                    var data = new google.visualization.DataTable(jsonData);
                    var options = {
                        fontName: 'Trebuchet MS',
                        colors: ['#22671F'],
                        title: 'Handicap History',
                        hAxis: {title: 'Revision Date', titleTextStyle: {color: 'red'}}
                    };
                    var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
                    chart.draw(data, options);
                }
            </script>
test3.php
$result = $connect->query("SELECT rev_date, ndx FROM revisions WHERE player_id=7");      
    $table = array();
    $table['cols'] = array(
    array('label' => 'Rev', 'type' => 'string'),
    array('label' => 'Index', 'type' => 'number')
    );
    $rows = array();
    while ($nt = $result->fetch_assoc())
    {
    $temp = array();
    $temp[] = array('v' => $nt['rev_date']);
    $temp[] = array('v' => $nt['ndx']);
    $rows[] = array('c' => $temp);
    }
    $table['rows'] = $rows;
    $jsonTable = json_encode($table);
    echo $jsonTable;
我希望能够在 test3.php 中做这样的事情
$result = $connect->query("SELECT rev_date, ndx FROM revisions WHERE player_id='$playerID'");      
    $table = array();
    $table['cols'] = array(
    array('label' => 'Rev', 'type' => 'string'),
    array('label' => 'Index', 'type' => 'number')
    );
    $rows = array();
    while ($nt = $result->fetch_assoc())
    {
    $temp = array();
    $temp[] = array('v' => $nt['rev_date']);
    $temp[] = array('v' => $nt['ndx']);
    $rows[] = array('c' => $temp);
    }
    $table['rows'] = $rows;
    $jsonTable = json_encode($table);
    echo $jsonTable;
如何将 $playerID 变量的值传递给 test3.php 页面?url: "test3.php"当在 ajax 中调用该片段并在 test3.php 上使用 $_GET时,我可以传递一个变量吗?还是有另一种方法可以做到这一点?  
非常感谢你。