我有一个json编码信息的问题,它通过ajax.Json加载包含barchart.linechart和table.json数据的多个数组
{"barchart":[{"Ap":0.4,"Cha":0.3,"Co":1.7667,"Dee":1,"Ma":0.2667,"Pa":0.2333,"Sha":0.6667,"Smr":0.3667,"Ve":0.0333,"Ya ":0.3333,"Yat":0.4}],"linechart":[[["Days","Ap","Apa","Cha","Dee","Di","Ma","Na","Pa","Ra","Sha","Sh","Smr","Ver","Ya ","Yat"],["2014-06-02",0,0,0,3,0,6,0,0,0,0,0,0,0,0,0],["2014-06-03",0,0,0,0,0,0,0,0,0,0,0,4,0,1,0],["2014-06-04",0,0,0,1,0,0,0,0,0,0,0,0,0,0,2],["2014-06-05",0,0,3,1,0,0,0,0,0,0,0,0,0,2,0],["2014-06-06",0,0,0,2,0,2,5,0,0,0,0,0,0,0,1],["2014-06-07",0,0,2,0,0,0,3,0,0,0,0,1,0,0,0],["2014-06-08",0,0,2,0,0,0,2,0,0,11,0,0,0,2,2],["2014-06-09",0,0,2,3,9,0,2,7,0,6,0,0,0,2,2],["2014-06-10",4,0,0,5,0,0,0,0,0,0,0,0,0,1,0],["2014-06-11",7,0,0,5,0,0,0,0,0,2,0,1,0,2,0],["2014-06-12",0,0,0,7,0,0,0,0,0,0,0,2,0,0,0],["2014-06-13",0,0,0,1,0,0,0,0,0,0,0,2,1,0,0],["2014-06-15",0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],["2014-06-16",1,0,0,1,0,0,0,0,0,0,0,1,0,0,4],["2014-06-17",0,0,0,1,0,0,0,0,0,1,0,0,0,0,0],["2014-06-19",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["2014-06-23",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["2014-06-24",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["2014-06-27",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["2014-06-28",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["2014-06-30",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]],"table":["
#<\/th> User Name<\/th> Activation Status<\/th> Last Logged <\/th> Total Number of Logins <\/th> Avg no. of Logins \/day<\/th><\/tr><\/thead>
1<\/td> Ap <\/td> Activated<\/td> June 16, 2014<\/td> 12<\/td> 0.4000<\/td><\/tr>
2<\/td> Apa <\/td> Activated<\/td> -<\/td> -<\/td> -<\/td><\/tr>
3<\/td> Ash<\/td> Not Activated
<\/td> -<\/td> -<\/td> -<\/td><\/tr>
4<\/td> Chai <\/td> Activated<\/td> June 9, 2014<\/td> 9<\/td> 0.3000<\/td><\/tr>
5<\/td> Com <\/td> Activated<\/td> June 30, 2014<\/td> 53<\/td> 1.7667<\/td><\/tr>
6<\/td> Dee <\/td> Activated<\/td> June 17, 2014<\/td> 30<\/td> 1.0000<\/td><\/tr>
7<\/td> Har <\/td> Not Activated
<\/td> -<\/td> -<\/td> -<\/td><\/tr>
8<\/td> Hy - Client <\/td> Not Activated
<\/td> -<\/td> -<\/td> -<\/td><\/tr>
9<\/td> Hyuy <\/td> Not Activated
<\/td> -<\/td> -<\/td> -<\/td><\/tr>
10<\/td> May <\/td> Activated<\/td> June 6, 2014<\/td> 8<\/td> 0.2667<\/td><\/tr>
11<\/td> Pa <\/td> Activated<\/td> June 9, 2014<\/td> 7<\/td> 0.2333<\/td><\/tr>
12<\/td> Rak <\/td> Activated<\/td> -<\/td> -<\/td> -<\/td><\/tr>
13<\/td> Sh <\/td> Activated<\/td> June 17, 2014<\/td> 20<\/td> 0.6667<\/td><\/tr>
14<\/td> Smr <\/td> Activated<\/td> June 16, 2014<\/td> 11<\/td> 0.3667<\/td><\/tr>
15<\/td> Ver <\/td> Activated<\/td> June 13, 2014<\/td> 1<\/td> 0.0333<\/td><\/tr>
16<\/td> Ya <\/td> Activated<\/td> June 11, 2014<\/td> 10<\/td> 0.3333<\/td><\/tr>
17<\/td> Yati <\/td> Activated<\/td> June 16, 2014<\/td> 12<\/td> 0.4000<\/td><\/tr>"]}
在ajax jquery中我想拆分这些json并将数据分配给图表。
$('.but').click(function(){
$.ajax({
url: main.php",
type:'POST',
dataType: 'json',
success: function(response){
$("#table").html(response);
答案 0 :(得分:0)
data=JSON.parse(response);
// you can visit this link
http://jsfiddle.net/pLUza/