I've been going nuts trying to figure out why my Geochart isn't displaying. I searched all over google and none of the solutions to similar questions have worked for me.
I tried adding an alert box right before the line that is erroring and displaying the json data, and I can see that there is data in it.
Any tips would be greatly appreciated.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', { 'packages': ['geochart']});
google.charts.setOnLoadCallback(getDataForMap);
function getDataForMap() {
$.ajax({
type: "POST",
url: "myWebService.asmx/getJSONData",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
timeout:600,
error: function (xhr, textStatus, error) {
alert("Error: " + error)
},
complete:function(response)
{
var data = new google.visualization.DataTable(response);
//THIS IS WHERE IT ALWAYS STOPS WORKING
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
var options = {
region: 'US',
displayMode: 'regions',
resolution: 'provinces',
};
chart.draw(data, options);
}
})
};
</script>