我有一个看起来像这样的对象:
Object {apps.sop.process: Object, stakeholders.sanction: Object, apps.sop.maps: Object, stakeholders.users: Object}
另一个看起来像这样的对象:
Object {resume: 8, stop: 2, start: 1, delegate: 16, pause: 4}
我的问题是对象被附加在div之外。我无法弄清楚这一点。我需要权限列表,这是附加到div的第二个对象,它是由第一个循环使用第一个对象生成的。
var permission = $.parseJSON(m);
var count = Object.keys(permission).length;
for (var x in permission){
i = permission[x];
console.log(x,i);
for (var r =0; r < count; r++){
container = $('.permissionsDiv');
panel = $('<div class ="col-md-4"><div class="panel-body"><div class="panel panel-cascade"><div class="panel-body"><ul class="list-group tree"><input type="checkbox" checked disabled /><label class="tree-toggle tree-parent">'+x+'<span class="glyphicon glyphicon-chevron-down"></span></label>');
for ( var y in i){
perm = $('<li class="list-group-item" data-val = '+i[y]+'><label><input type="checkbox" checked disabled />'+y+'</label></li>');
perm.appendTo(panel);
//$('.tree').append(perm);
}
}
container.append(panel);
}
任何形式的帮助将不胜感激。对不起,如果我是新手,我很抱歉。