我试图使用Jquery模板for循环从下面呈现值,但没有从Json中获取任何值。下面是我的Json:
{
"CommentListClass":[
{
"Author":"Attis1",
"CommentText":"Really goo"
},
{
"Author":"joshar1",
"CommentText":"My picture"
},
}我的Jquery模板是:
<script type="text/x-jsrender" id="tempRecentComments">
{{for List}}
<div class="item">
<div class="item-content">
<h3>{{:CommentListClass.Author}}</h3>
</div>
</div>
{{/for}}
</script>发布于 2014-04-17 11:16:39
尝尝这个,
{{for CommentListClass}}
<div class="item">
<div class="item-content">
<h3>{{:Author}}</h3>
</div>
</div>
{{/for}}使用数据,比如,
[{
"CommentListClass": [{
"Author": "Test",
"CommentText": "Really goo"
}, {
"Author": "joshar1",
"CommentText": "My picture"
}]
}];jsviews测试
https://stackoverflow.com/questions/23131385
复制相似问题