Jquery如何解析JSON子集
JSON数据如下[{"cities":[],"id":1,"name":"北京市","universities":[{"id":1,"name":"清华大学","prov...
JSON数据如下
[{"cities":[],"id":1,"name":"北京市","universities":[{"id":1,"name":"清华大学","province":null,"useruniversities":[]},{"id":2,"name":"北大","province":null,"useruniversities":[]}],"userses":[]}]
我想取到universities节点数据解析
success : function(data) {
//alert("success : " + data);
$(data).each(function() {
alert(this);
alert(this['id'] + " " + this['name']);
$(data.universities).each(function() {
alert(this['id'] + " " + this['name']);
});
});
} 展开
[{"cities":[],"id":1,"name":"北京市","universities":[{"id":1,"name":"清华大学","province":null,"useruniversities":[]},{"id":2,"name":"北大","province":null,"useruniversities":[]}],"userses":[]}]
我想取到universities节点数据解析
success : function(data) {
//alert("success : " + data);
$(data).each(function() {
alert(this);
alert(this['id'] + " " + this['name']);
$(data.universities).each(function() {
alert(this['id'] + " " + this['name']);
});
});
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询