这里是我的JSON对象:jQuery的每个分割JSON单字符
var home = "[{\"id\":\"1\",\"img\":\"assets\\\/1.jpg\",\"headline\":\"This is the headline in the pedu.\",\"text\":\"To the ipedu\"},{\"id\":\"2\",\"img\":\"assets\\\/2.jpg\",\"headline\":\"This is the headline in the pedulence.\",\"text\":\"To the pendula\"}]";
当我通过这样的对象尽量循环:
$.each(home, function() {
console.log(this);
});
我得到的每一个字符记录的,而不是整个字符串。
实施例: 字符串{0: “[”} 本地主机:317 字符串{0: “{”} 本地主机:317 字符串{0: “”“} 本地主机:317 字符串{0:的 “i”} 本地主机:317 字符串{0: “d”} 本地主机:317 字符串{0: “”“} 本地主机:317 字符串{0: ”:“} 本地主机:317 字符串{ 0:“”“} localhost:317 字符串{0:”1“} localhost:317 字符串{0: “” “} 本地主机:317 字符串{0:”, “} 本地主机:317 字符串{0: ”“”} 本地主机:317 字符串{0: “i” 的}
我在做什么错?如何遍历对象?
谢谢...我认为这就是它! – hjuster