【发布时间】:2009-09-13 17:58:16
【问题描述】:
我可能缺少 json 和 javascript 的内容。
[{"commentText":"Testing 123","userPosted":"maxfridbe"},
{"commentText":"Testing 23","userPosted":"maxfridbe"}]
有时我会收到多个与此代码一起使用的响应:
function(data)
{
var sel = this;
jQuery.each(data,
function()
{
sel.append("<li>"+ this.userPosted+ "-" + this.commentText + "</li>");
});
};
有时我只收到一个破坏上述代码的响应:
[{"commentText":"another test again welcom","userPosted":"maxfridbe"}]
我知道这是因为响应的处理方式与列表不同。
在寻找这个问题的答案时,我有点不知所措。任何解决方案将不胜感激。
【问题讨论】:
标签: javascript asp.net-mvc json