I am using Ajax code to load an html page
eg:
$.ajax({ url: 'Context.html', dataType: 'html', timeout: 500, success: function(html) { $("div#mainbody").html(html); } });
The Context.html I upload it to another html page, for example: Home.html
But I am creating pie charts using google API in Context.html
and the code for creating the ie pie chart in Context.html is
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Year', 'Count'], ['2005', 70], ['2006', 80], ['2007', 140], ['2008', 220], ['2009', 290], ['2010', 400], ['2011', 500] ]); var options = { title: 'Head Count-(Apple Year)', colors:['#129212'] }; var chart = new google.visualization.ColumnChart(document.getElementById('jsf_headcount_bargraph')); chart.draw(data, options); } </script>
When I load Context.html in the Home.html page, I cannot find the pie chart that is in Context.html after loading in Home.html
I tried to give ALERT (""); in the script where I wrote the code for the pie chart. I was getting a warning message, so Ajax is executing javascript, but I am not getting a pie chart, which is the same script. So I got hooked on the boot pie chart on the Home.html page