【发布时间】:2013-01-24 17:30:23
【问题描述】:
我正在使用 jQuery 模板插件来显示来自 Google Books API 的 JSON 信息以在此处生成图书列表:http://jsfiddle.net/yuW6L
我可以使用模板标签从 JSON 中获取并显示基本信息,例如标题
{{each items}}
和
${volumeInfo.title}
但 ISBN 嵌套在 JSON 的一部分中,如下所示:
...
"industryIdentifiers":[
{
"type":"ISBN_10",
"identifier":"1593374313"
},
{
"type":"ISBN_13",
"identifier":"9781593374310"
}
我无法以这种方式显示 ISBN-10:
volumeInfo.industryIdentifiers.identifier[1]
我觉得我做不到:
{{each items.volumeInfo.industryIdentifiers}}
...
${identifier}
ISBN-10的解析和显示方式是什么?
【问题讨论】:
-
我的是使用jQuery模板插件
-
你可能不应该再使用它了,因为它是一个废弃的项目。不过没关系,访问对象属性的规则是一样的,只有当你使用
each时入口点会改变。如果您确实需要each的演示,请查看以下示例:jquery.github.com/jquery-tmpl/demos/step-by-step/…。官方文档好像已经不存在了。
标签: jquery json each google-books