Hi,
2 pages:
when I point directly to charts.php everything works fine!
the issue is when I load charts.php with AJAX inside main.php page.
basically main.php loads with AJAX charts.php. Here I got the issue, google charts are not displayed and if I reload the page it goes blank.
Seems that it cannot load the google library properly, the error is Uncaught ReferenceError: google is not defined.
here is some details:
main.php
================================================================
....
<div class="row">
<div class="col-md-12">
<!-- Tab panes -->
<div class="fade in">
<div id="loading" class="col-md-12 text-center"><h3><img src="images/loader.gif"> Loading...</h3></div>
<div id="content" class="col-lg-12 col-md-12 col-xs-12"></div>
</div>
</div>
</div>
<script>
/**
* Load the first page on page ready
*/
$( document ).ready(function() {
$('#mainTab a:first').tab('show');
loadFundDetailUrl('pages/charts.php?id=<?=$_Id?>');
});
/**
* Load Urls with AJAX
*/
function loadDetailUrl(url){
jQuery.ajax({
type: "POST", // HTTP method POST or GET
async: true,
url: url,
dataType:"html", // Data type, HTML, json etc.
data: null, //Form variables
success:function(response){
$("#content").html(response);
$('#loading').hide();
},
error:function (xhr, ajaxOptions, thrownError){
$("#content").html('Content not found!');
$('#loading').hide();
console.log(thrownError);
}
});
}
</script>
================================================================
charts.php
================================================================
<!-- USING GOOGLE CHARTS -->
<script>
google.load("visualization", "1", {packages:["corechart"]});
</script>
<!-- PORTFOLIO COMPOSITION -->
<script type="text/javascript">
function drawChart() {
.......
}
google.setOnLoadCallback(drawChart);
=================================================================
Any suggestions ??? please help! :-)
thnak you