後台返回的map,,這是要接收value值得table, ,這是js。。注釋是我寫的,出來的都是重復的
就是map集合在JS中的遍歷
給你個參考 你網上在搜一搜
在js中遍歷map集合 (2013-07-31 17:38:57)
轉載
▼
分類: json
//首先你要遍歷的東西是一個對象,如['name':''zhangsan','key':'mongy'],如果是字符串形式的應該先eval下
1 .遍歷map集合
var data =[{"ccac8078-07a6-46c9-b450-b696db1a6f99":"qsss","01":"wlc","name":"wlc"}];
var map = data[0];
for (var key in map) {
alert("map["+key+"]"+map[key]);
}
2,遍歷對象
var list = [{"cid":"c3e1109c-5279-4cd3-a5c6-36f31e94b78e","cloginname":"yuxiaojie","cpassword":"123","cremark":"ww","cstatus":"\u0000","ctype":"\u0000","cusername":"wangalichao","dcreatedatetime":null,"dmodifydatetime":null},{"cid":"ccac8078-07a6-46c9-b450-b696db1a6f99","cloginname":"qsss","cpassword":"w","cremark":"www","cstatus":"\u0000","ctype":"\u0000","cusername":"w","dcreatedatetime":null,"dmodifydatetime":null}];
for (var i in list) {
alert(list[i]);
}