I have a JSON from PHP assoc array:
Array(
[0] = > Array(
[topicid] = > 17
[entry] = > number 12 this one
[belongdate] = > 2017 - 06 - 12
[edittime] = > 2012 - 06 - 18 05: 22: 21
[User_ID] = > 1
)
[1] = > Array(
[topicid] = > 9
[entry] = > yeah 11 now
[belongdate] = > 2017 - 06 - 12
[edittime] = > 2012 - 06 - 18 05: 22: 02
[User_ID] = > 1
)
)
I don't give you JSON straightly is because I don't know how to print JSON properly.
I need to create parent div and multiple children elements:
<div name='entrydiv' class='entrydiv'>
<h3 name='topich3' class='topich3'>
entryjson[i]['topicid']
</h3>
<p name='entryp' class='entryp'>
entryjson[i]['entry']
</p>
<a name='belongdatea' class='belongdatea' style='display: none;'>
entryjson[i]['belongdate']
</a>
<a name='lastedittimea' class='lastedittimea'>
entryjson[i]['edittime']
</a>
</div>
Note the contents are variable from JSON. I have checked out this post. But the .append method does't seem to support passing variable to the content. And the .appendTo method does not allow child element(?). I appreciate your help very mush. Thanks.
topicid
" + entryjson[i]['entry']" + "
";` – Victor Jun 17 '12 at 22:11