我想通过变量将变量传递到另一个页面,就像我们使用ajax即(类型:post和data:data)传递变量一样。
function showGraph1() {
{
$.post("data.php",
function(data) {
var name = [];
var marks = [];
for (var i in data) {
name.push(data[i].NAME);
marks.push(data[i].PERCENTAGE);
}
var chartdata = {
labels: name,
datasets: [{
labels: ["#000000", "Blue", "Yellow", "Green", "#E07C0AF"],
data: marks
}]
};
var graphTarget = $("#graphCanvas1");
var barGraph = new Chart(graphTarget, {
type: 'doughnut',
data: chartdata,
});
});
}
}