我很困惑如何通过把手获取这个json数据,这是从连接到api样本..非常感谢你。
[
{
"template_name": "Sample",
"preview_url": "http://sample.com",
"thumbnail_url": "https://sample.jpg",
"template_id": 10010101,
"template_properties": {
"can_build_from_url": false
}
},
{
"template_name": "Sample",
"preview_url": "http://sample.com",
"thumbnail_url": "https://sample.jpg",
"template_id": 10010101,
"template_properties": {
"can_build_from_url": false
}
},
{
"template_name": "Sample",
"preview_url": "http://sample.com",
"thumbnail_url": "https://sample.jpg",
"template_id": 10010101,
"template_properties": {
"can_build_from_url": false
}
}
]
这是我的代码尝试使用把手从我的javascript模板中获取数据:
<script id="apiTemplate" type="text/template">
<div class="templates">
<div class="photo-col">
<img src="{{thumbnail_url}}" alt="" />
</div>
<div class="info-col">
<h2 class="temp-name">Template Name: {{template_name}}</h2>
<ul>
<li>ID: {{template_id}}</li>
<li>Can build from URL: {{template_properties.can_build_from_url}}</li>
</ul>
<div class="start">
<a href="{{preview_ur}}"><button>Preview Temaplate</button></a>
</div>
</div>
</div>
</script>