开发者

Difficulty in displaying Json objects in arrays

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&开发者_开发百科quot;);            
            },

What is wrong with the above?


Your JSON doesn't not seem right. it should be

[{"ID":358,"Name":"Test","Client":{"ID":160,"Name":"Client1"},"HasUsers":false}]

instead of

[{"ID":358,"Name":"Test,"Client":{"ID":160,"Name":"Client1"},"HasUsers":false}]

"Test, should be "Test", which is what is messing with Client, probably.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜