我的 data.json 看起来像这样:
{
"selection_form" : {
"entities" : {
"name":"0002" ,
"name":"0103" ,
"name":"0104" ,
"name":"0122" ,
....
这个脚本看起来像这样
<script>
$.getJSON('data.json', function(data) {
$.each(data.selection_form.entities, function(i,item){
$("#enity").append('<p>'+data.selection_form.entities.name+'</p>');
});
});
</script>
我想将所有名称都包含在 ap 标签中,例如
<p>0002</p><p>0103</p>....
但结果只是姓氏项目。我找不到解决办法。需要帮忙!