I am having issue with Google line chart API. When I reload the div, the line chart does not load again.
This is the code for line chart
<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 = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'Sales');
data.addRows(4);
<?php
//gets line chart data
echo $join;?>
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, {width: 320, height: 250, title: ''});
}
</script>
<h3>Sales History</h3>
<table border="5" style="border-color: #3b6aa8;" >
<tr>
<td>
<div id="chart_div" style="border: 1;border-color: green;"></div>
</td>
</tr>
</table>
code used to reload the div
<script type="text/javascript">
$(document).ready(function() {
$('#sliderform').submit(function() {
bodyContent = $.ajax({
url: "dashboardreload.php",
global: false,
type: "POST",
data: ({year : $("#yearval").val(), month: $("#monthval").val(),day : $("#dayval").val(),
year1 : $("#year1val").val(), month1: $("#month1val").val(),day1 : $("#day1val").val()
}),
dataType: "html",
async:false,
success: function(msg){
//alert('test');
}
}
).responseText;
$('#dash').html(bodyContent);
//confirm(bodyContent);
return false;
});
});
</script>