在数组中显示 Json 对象的困难
当页面第一次加载时,它工作正常并显示数据。
当我进行搜索时返回的数据是
"[{"ID":358,"Name":"Test,"Client":{"ID":160,"Name":"Client1"},"HasUsers":false}]",但是我`我收到消息错误:
客户端未定义
我有以下代码:
在我的视图
<script id="myTemplate" type="text/x-jquery-tmpl">
<tr>
<td>${Client.Name}</td>
<td>${Name}</td>
</tr>
</script>
代码中进行绑定
success: function (data) {
$("#myTemplate").tmpl(data).appendTo("#dataBody");
},
上面有什么问题吗?
When the page is loading for the first time, it`s working fine and displaying the data.
When I am doing a search the data returned are
"[{"ID":358,"Name":"Test,"Client":{"ID":160,"Name":"Client1"},"HasUsers":false}]", but i`m having the message error:
Client is not defined
I am having the following piece of code:
In my View
<script id="myTemplate" type="text/x-jquery-tmpl">
<tr>
<td>${Client.Name}</td>
<td>${Name}</td>
</tr>
</script>
code to bind
success: function (data) {
$("#myTemplate").tmpl(data).appendTo("#dataBody");
},
What is wrong with the above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的 JSON 似乎不对。它应该
代替
"Test,
应该是"Test",
这可能是困扰客户端的原因。Your JSON doesn't not seem right. it should be
instead of
"Test,
should be"Test",
which is what is messing with Client, probably.