我正在尝试从我的API中显示机构列表,在这里我只想显示10个,当load more
按钮被单击时,它应该显示剩余的,load more
按钮包含下一页的url,即json格式的剩余列表
html代码如下
<div class="container text-center">
<h1 class="text-center">Existing Institutions </h1>
<div class="row row-centered">
<div class="col-md-10 col-md-offset-1">
<div class="col-md-12">
<div class="table-responsive">
<table id="claimList" class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th class="header"> Institute Name <i class="icon-sort"></i></th>
<th class="header"> Address <i class="icon-sort"></i></th>
<th class="header"> Location <i class="icon-sort"></i></th>
</tr>
</thead>
<tbody>
{% for key in data %}
<tr>
<td><a href="../institutedetails?businessId={{ key.businessId }}">{{ key.displayName }}</a></td>
<td>{{ key.businessAddress }}</td>
<td>{{ key.businessLocation }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="pager">
<li class="next"><button name="load_more" id="load_more" onsubmit="loadMore({{ nextPage }});">Load More</button></li>
</ul>
</div>
</div>
</div>
</div>
</div>
我的ajax
代码是
我得到了data
中的数据。现在如何解析data
并在html表中显示
数据表集成
把它放在HTML中确保jquery被添加。在
javascript代码:
^{pr2}$数据表集成视图.py请确保已为此添加了URL
如果您想在移动中加载内容,您应该使用AJAX,而且由于您使用的是jQuery,所以可以使用
jQuery.getJSON(URL, callback)
。在相关问题 更多 >
编程相关推荐