var qname = []; var qc = []; var nums = []; $.ajax({ type: 'POST', url: ''', data:{"t0":start,"t1":end}, success:function(ds){ if(ds.length==0 || ds[0].num==0 && ds[1].num==0 && ds[2].num==0){ $('#infoThreeDisplay ').hide(); $('#noInfoThreeDisplay ').show(); $('#historyQualityBut ').attr('disabled ','disabled '); $('#historyQualityBut ').css({'background - color ':'gray '}); }else{ $('#noInfoThreeDisplay ').hide(); $('#infoThreeDisplay ').show(); $('#historyQualityBut ').removeAttr("disabled"); $('#historyQualityBut ').css({'background - color ':'#5bc0de '}); for(var i=0;i<ds.length;i++){ qname[i]=ds[i].label; nums[i]=ds[i].num; qc=qc+' < tr > ' +' < td > <p > <i class = "fa fa-square '+color3[i]+'" > </i>'+ds[i].label+'</p > </td>' +'<td>'+ds[i].num+" 件"+'</td > ' +' < /tr>' } $('#numOne3').empty().append(qc); $('#canvas3').empty(); Morris.Donut({ element: 'canvas3', data: ds, colors: ["#26B99A", "#FFFF37","#E74C3C"], formatter: function (y) { return y + "%"; }, resize: true }); } } });