如何使用amchary URL传递javascript变量

时间:2015-02-21 11:21:27

标签: javascript php

 function custom(vall)
 {

   var chart;


  // create chart
   AmCharts.ready(function() {
    alert(vall);
  // load the data
 var chartData =   AmCharts.loadJSON('http://localhost/vivek/daydata.php?data=vall');                                                   

  // SERIAL CHART    
 chart = new AmCharts.AmSerialChart();
 chart.pathToImages = "http://www.amcharts.com/lib/images/";
 chart.dataProvider = chartData;
chart.categoryField = "hrs";
 chart.theme = "none";
 chart.type = "serial";
}

var chartData = AmCharts.loadJSON('http://localhost/vivek/daydata.php?date=vall'); 我希望在这个网址中传递vall,但它不是值,在url中只显示vall变量而不是值。

1 个答案:

答案 0 :(得分:0)

我认为下面应该适合你。取出val变量形式的引号。

AmCharts.loadJSON( “http://localhost/vivek/daydata.php?data=” +瓦尔);