Javascript 将变量从Google图表脚本传递到MySql PHP

Javascript 将变量从Google图表脚本传递到MySql PHP,javascript,php,charts,Javascript,Php,Charts,我需要在GoogleChart脚本之前,从$u GET['variableID']传递一个变量,然后传递到目标页面PHP,以确定要执行查询的客户端。我怎么能?(注意:我不是javascript天才)。非常感谢 这是我定义的chart.js /* Get data from the database */ function getData() { jQuery.ajax({ url: 'get.php', type: 'GET', dataT

我需要在GoogleChart脚本之前,从$u GET['variableID']传递一个变量,然后传递到目标页面PHP,以确定要执行查询的客户端。我怎么能?(注意:我不是javascript天才)。非常感谢

这是我定义的chart.js

/* Get data from the database */
function getData() {
    jQuery.ajax({
        url: 'get.php',
        type: 'GET',
        dataType: 'json',
        mimeType: 'multipart/form-data',
        contentType: false,
        cache: false,
        processData: false,
        success: function( data, jqXHR ) {
            if( data == "null" ) {
                // just in case
            } else {
                drawGraph( data );
            }
        },
        error: function( textStatus ) {
            console.log(" error. damm. ");
        }
    });
}

/* Initialization of Google Charts API */
google.load( "visualization" , "1", { packages: [ "corechart" ] });
google.setOnLoadCallback( getData );

/* Chart to render time-user graphs */
function drawGraph( data ) {
    for( var i = data.length; i > 0; i-- ) {
        data[i] = data[i - 1];
    }
    data[0] = [ 'Data', 'Comandes' ];
    console.log( data );
    var chartData = google.visualization.arrayToDataTable( data );var options = {
      title: '','legend':'none','chartArea': {'width': '100%', 'height': '80%'},

backgroundColor: {
    stroke: '#a5a5a5',
    strokeWidth: 1
},


      hAxis: {
        format: 'M/d/yy',
        gridlines: {count: 15}
      },
      vAxis: {
        gridlines: {color: '#d0d0d0'},
        minValue: 0
      }
    };

    var chart = new google.visualization.LineChart( document.getElementById( 'chart_div' ) );

    chart.draw( chartData , options );
}
这是get.php(请特别注意其中的idclient=get variableID)


在ajax调用中,将变量添加到url

jQuery.ajax({
  url: 'get.php?variableID=variableVALUE',
  ...  
然后在php代码中,使用
$\u GET['variableID']

$query = "select DATE( data ), COUNT(*)
  from smarty_pedidos  WHERE idclient=$_GET['variableID']
  group by DATE( data )";

在ajax调用中,将变量添加到url

jQuery.ajax({
  url: 'get.php?variableID=variableVALUE',
  ...  
然后在php代码中,使用
$\u GET['variableID']

$query = "select DATE( data ), COUNT(*)
  from smarty_pedidos  WHERE idclient=$_GET['variableID']
  group by DATE( data )";