【发布时间】:2014-05-28 16:14:06
【问题描述】:
如果名称等于Test,是否可以打印Can、Bottle和Fountain
有人可以帮忙在 if 块中添加一个条件以匹配条件吗??
$.each(value, function (i, v) {
if(i.name=="Test")
{
}
});
从下面的JSON格式
[
{
"id": "0004",
"name": "Test",
"image": {
"url": "images/0001.jpg",
"width": 200,
"height": 200
},
"Can": [
"250ml",
"300ml",
"330ml",
{
"image": "images/0001.jpg"
}
],
"Bottle": [
"350ml",
"600ml",
{
"image": "images/0001.jpg"
}
],
"Fountain": [
"small",
"large",
{
"image": "images/0001.jpg"
}
]
}
]
【问题讨论】:
-
这个 json 结构似乎关闭了。首先是 id 和 name 作为键,然后是“Can”、“Bottle”、“Fountain”作为键?我们在这里缺少什么?
标签: jquery