我想用algolia搜索结果填充表格。我有这个HTML
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Product</th>
<th>quantity</th>
<th>Status</th>
<th>Phone</th>
<th>Fax</th>
</tr>
</thead>
<tbody id="hits">
</tbody>
</table>
<script type="text/html" id="hit-template">
<tr id="hit">
<td>
<div class="round-img">
<a href=""><img src="images/avatar/4.jpg" alt=""></a>
</div>
</td>
<td>${{VendorName}}</td>
<td><span>iBook</span></td>
<td><span>456 pcs</span></td>
<td><span class="badge badge-success">Done</span></td>
<td><span>${{Active}}</span></td>
<td><span>${{Vendortype}}</span></td>
</tr>
</script>
这是我的js脚本
search.addWidget(
instantsearch.widgets.hits({
container: '#hits',
templates: {
item: document.getElementById('hit-template').innerHTML,
empty: "We didn't find any results for the search <em>\"{{query}}\"</em>"
}
})
);
search.start();
搜索正在运行,但表格未正确填充。这就是显示的内容
我做错了什么,我怎么能解决这个问题呢?它正确填充在桌面上?