Home Forums Chart Support I want to load graph on year change Reply To: I want to load graph on year change

#38839

@anexgate,

There are couple of issue in the sample that you have shared. Please find them address below.
1. CanvasJS & jQuery scripts are not present in the project
2. Variable names are not proper across multiple files (getData.php, getSearch.php & index.php).
Below is the code-snippet with the updated variable names.


/* getSearch.php */
echo json_encode($data_points, JSON_NUMERIC_CHECK); -> echo json_encode($yr_arr, JSON_NUMERIC_CHECK);

/* getData.php */
$handle->bindParam(":year",$_POST["year"], PDO::PARAM_INT); -> $handle->bindParam(":year",$_GET["curnt_year"], PDO::PARAM_INT);

/* index.php */

$.getJSON("getSearch.php", data, function(result){ -> $.getJSON("getSearch.php", function(response){
.
.
$.getJSON("getData.php", data, function(result){ -> $.getJSON("getData.php", data, function(response){

Please download the updates sample project form here.

Chart from Dropdown List Selection in PHP

—-
Manoj Mohan
Team CanvasJS