Double quote in php json encode -
the json out of file is:
[{"name":"ltrs","data":["25","80","110","113","139","1025","1026","1027","1028","1029"]},{"name":"total","data":["3","723","19","48","3","6","14","17","15","6"]}]
i require:
[{"name":"ltrs","data":["25","80","110","113","139","1025","1026","1027","1028","1029"]},{"name":"total","data":[3,723,19,48,3,6,14,17,15,6}]
json required plotting bar chart in highchart.js
.
when run php query mysql json encode gives output double quote.
i guess want if name = total
here code try it:
var = [{"name":"ltrs","data":["25","80","110","113","139","1025","1026","1027","1028","1029"]},{"name":"total","data":["3","723","19","48","3","6","14","17","15","6"]}]; $.each(a, function(k,v){ if(v.name == 'total'){ $.each(v.data, function(k1,v1){ v.data[k1] = v1*1;; }); } }); console.log(a);
Comments
Post a Comment