There is an issue that I cannot solve, I\'ve been looking a lot in the internet but found nothing.
I have this JavaScript that is used to do an Ajax request by PHP.
This works for me
google.load("visualization", "1", { packages: ["corechart"] });
var chart ;
var data ;
var options;
function Change(s)
{
// s in json format
google.setOnLoadCallback(reDraw(s));
function reDraw(s) {
console.log(new Function("return " + s)().length); // to test if json is right
data = google.visualization.arrayToDataTable(new Function("return "+s)());
options = {
title: 'Product Scanes',
vAxis: { title: '', titleTextStyle: { color: 'red'} }
};
}
chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
function requestDate() // cal the method when you want to draw the chart
{
$.ajax({
type: "POST", // CHANGED
// contentType: "application/json; charset=utf-8",
url: "something.php",
data: { parameters you wanna pass },
success: function (d) {
Change(d);
}
});
}
}