JSON для подсчета:
[{"thn":"2017","jumlah":"30"},{"thn":"2018","jumlah":"80"},{"thn":"2018","jumlah":"64"},{"thn":"2018","jumlah":"5"},{"thn":"2018","jumlah":"1"},{"thn":"2018","jumlah":"1"},{"thn":"2018","jumlah":"4"},{"thn":"2018","jumlah":"5"},{"thn":"2018","jumlah":"198"},{"thn":"2018","jumlah":"2"},{"thn":"2018","jumlah":"202"},{"thn":"2019","jumlah":"31"},{"thn":"2019","jumlah":"1"}]
это мой код
var data_nama=[];
var data_jumlah=[];
$.post("<?=base_url('Welcome/checkData')?>",
function(data){
var obj = JSON.parse(data);
$.each(obj,function(test,item){
data_nama.push(item.thn);
data_jumlah.push(item.jumlah);
});
Как добавить тот же год, например
2018 должен 562, не 80, 64
извините за мой плохой английский sh> <</p>