我想读取一个嵌套的JSON消息,他们的键值正在递增整数值,但它似乎不工作。嵌套的JSON与增量键值
$.each(data.post, function(entryIndex, entry) {
$.each(this.entryIndex, function() {
alert(this.username);
});
});
对不起,我试图粘贴JSON代码在这里,但我一直在得到格式错误。相反,我已经上传了JSON here。
我想读取一个嵌套的JSON消息,他们的键值正在递增整数值,但它似乎不工作。嵌套的JSON与增量键值
$.each(data.post, function(entryIndex, entry) {
$.each(this.entryIndex, function() {
alert(this.username);
});
});
对不起,我试图粘贴JSON代码在这里,但我一直在得到格式错误。相反,我已经上传了JSON here。
你去太深的水平:
$.each(data.posts, function() {
alert(this.username);
});
在这里看到:http://jsfiddle.net/8sb8j/2/
这将让你的答复的用户名:
$.each(data.posts, function() {
$.each(this.replies, function(){
alert(this.username);
});
});
非常感谢:) – Jon 2012-02-14 06:28:31
没问题。很高兴我能帮上忙。 – 2012-02-14 07:04:44
$.each(data.posts, function(entryIndex, entry) {
alert(this.username);
});
我在这里尝试过(http://jsfiddle.net/uLgFz/),但它似乎没有工作。 – Jon 2012-02-14 06:09:21
对不起!..查看编辑:) – 2012-02-14 06:20:59
我们可以看到JSON你正在与?你确定JSON字符串已经被解析成一个对象吗? – Chad 2012-02-14 05:57:37
你能提供json对象结构吗?可能包含一些示例数据? – 2012-02-14 05:57:47