Refresh / Update Charts from jquery script.

114 views
Skip to first unread message

Angel Gonzalez

unread,
Jan 13, 2024, 7:55:23 PMJan 13
to Google Visualization API
Hi everyone, 

I'm using Google Charts with data from mySQL and it provides the results the first time. The php page that has the chart and table results has a dropdown option where the data can be changed. The date updates the mySQL query using a jquery function. See below.The problem is that the Google Chart is not updating when a new date range is provided. Can someone tell me how the chart can be updated on date change. I would imagine it's one line of code to put into the jquery script.

Thanks
Angel


The Query
$dbDemographicsQuery = "SELECT Race, COUNT(Race) AS totalRace, Ethnicity
FROM Greeter_Detail
WHERE $dateRange
GROUP BY Race";


JQ used to update dates:
$('#month, #year').on('change', function() {
var url = window.location.href;
url += '?month=' + $('#month').val();
url += '&year=' + $('#year').val();
$('#table-data').load(url + ' #table-data > *');
});
Reply all
Reply to author
Forward
0 new messages