I am working on a project with FusionCharts that requires me to update a javascript variable with an AJAX request. The FusionChart populates itself with the xml within the 'chart1.setDataXML()' tag as seen below.
<div id="barGraph">
Bar Graph
</div>
<script language="JavaScript">
var chart1= new FusionCharts("/charts/Column3D.swf", "barGraph", "600", "400", "0", "1");
chart1.setDataXML("<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' decimals='0' formatNumberScale='0'><set label='Jan' value='462'/><set label='Feb' value='857'/><set label='Mar' value='671'/><set label='Apr' value='494'/><set label='May' value='761'/><set label='Jun' value='960'/><set label='Jul' value='629'/><set label='Aug' value='622'/><set label='Sep' value='376'/><set label='Oct' value='494'/><set label='Nov' value='760'/><set label='Dec' value='960'/></chart>");
chart1.render("barGraph");
</script>
As I said, I need to update that XML within that script with an AJAX request. I have created a function that updates the chart, but I can't figure out how to bring AJAX into play... Here's my function
<script type="text/javascript">
function updateChart(domId){
var response= "<chart></chart>"
var chartObj = getChartFromId("barGraph");
chartObj.setDataXML(response);
}
</script>
Is there any way I can make my AJAX request update the 'response' variable?