我已经坐了很长时间来完成转换 javascript 对象并将其打印在页面上的相对简单的任务。然而,什么也没有出现。任何人都可以看到任何明显的缺陷吗?
<script>
$(document).ready(function() {
$('#some_div').html(render_lists());
});
function render_lists(){
var data = {
"1": {
"title": "Top 10",
"0": "Number one",
"1": "Number two"
}
};
var result_html = '';
result_html+='<div class="row">';
var i = 1;
for(entry in data){
result_html+='<div class="four columns" id="pane"'+i+'" style="display:none;"><div class="panel">';
result_html+='<p>'+data[entry].title+'</p>';
result_html+='</div><div class="box"><table width="100%">';
delete data[entry].title;
for(key in data[entry]){
result_html+='<tr><td>'+data[entry][key]+'</td></tr>';
}
result_html+='</table></div></div></div>';
i++;
}
return result_html;
}
</script>