This is probably so simple it's an insult to your intelligence, but what's wrong with this code. I want the chart to display when clicking the button - it just hangs. If I take away the definition of the dspChart function the chart draws fine.
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript">
function dspChart() {
google.load('visualization', '1', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
}
function drawChart() {
// Create our data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1]
]);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('fig'));
chart.draw(data, null);
}
</script>
</head>
<body>
<input type="button" value="display chart" onclick="dspChart();">
<div id="fig"></div>
</body>
</html>