现在有一个json文件名为 toto.json,然后我现在要遍历它再将它存到表格里。
我现在是嵌入json文件到我的html文件里面,因为json文件比较大。
所以我现在想单独存为一个json文件,然后用html去引用它,再解析,再存到html的表格table里。而不是像我这样把json文件全部放在html里.
我的代码如下:
var toto= {
"tweet": [
{
"ww": "222",
"qq": "77",
"ss": "7778",
"gggg": adsa,
"bbbb": [],
"jjjj": "weqrqwerqwerqw",
"rrr": "ZDFsadfasdfasdfa",
"yyy": "asdfasdfasdfasdfasdfsadfas",
"ddd": [
"dddd",
"aaaa",
"ssss"
],
"sssss": "",
"sssssdd": "wenshaw",
"rrttt": "2015-05-14",
"uuuu": null,
"rrrr": null,
"qqq": null,
"wwww": "2015-05-014",
"id": q
}]
};
//遍历
for(var i=0;i
{ //{alert(toto.tweet[i].id);}
var row = $("
")
$("#example").append(row); //this will append tr element to table... keep its reference for a while since we will add cels into it
row.append($("" + toto.tweet[i].id+ ""));
//......
=================================================