我想要选择一个变量,然后在我的ajax调用获得新的json时更新变量的值,但我无法弄清楚如何做到这一点。有人可以向我解释如何选择homePoints和awayPoints变量并将其替换为我的更新值吗?
var homePoints = game.total_points_bet_on_hometeam;
var awayPoints = game.total_points_bet_on_awayteam;
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: [homeTeam, awayTeam],
datasets: [{
backgroundColor: [
hue,
hueTwo
],
data: [homePoints, awayPoints]
, borderWidth: 0
}]
},
options: {
responsive: true
, maintainAspectRatio: true
}
});