语言

Menu
Sites
Language
How to use array in the data array?
It's really easy question.
The bold "result[][]" is below.
How to use the array??
Thank you.
 
var result;
$(function(){
    var memberId = 1 
    $.ajax({
        type: 'post',
        dataType: 'json',
        url: 'http://IP/records/myChart2.php',
        data:{
 
workout : workout
},
success : function(result) {
if(result.success == false) {
alert(result.msg);
return;
}
i=0;
while(i<4){
j=0;
while(j<7){
alert(result[i][j]);
j++;
}
i++;
}
 
}
    })
});
var config = {
    type: 'pie',
    data: {
        datasets: [{
            data: [
                result[0][0],
                90,
                90
            ],
            backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C"
            ],
            label: 'Dataset 1'
        },],
        labels: [
            "One",
            "Two",
            "Three"
        ]
    },
    options: {
        responsive: true,
        legend: {
            position: "top",
        },
        title: {
            display: true,
            text: "2018.x.x 나의 기록"
        }
    }
};
 
window.onload = function() {
    var ctx = document.getElementById("mychart").getContext("2d");
    window.myDoughnut = new Chart(ctx, config);
};
 

响应

1 回复
명훈 심

I missed workout. Solved.