我有一个网站,上面有一个表,我想定期更新数据。
我有一个脚本:
<script src="/js/jquery.min.js"></script>
<script>
$( document ).ready(function() {
setTimeout( function results() {
$('.results').load("results.php?RES=1");
setTimeout(results, 120000);
}, 0000);
})
</script>
这会在页面准备好后每两分钟运行一次。
results.php?RES = 1的响应如下:
<th colspan='7'>DS1</th>
<tr>
<td>1</td>
<td>02:02:48</td>
<td>(1) Name</td>
<td>TEAM</td>
<td>ger</td>
<td></td>
<td></td>
</tr><tr>
<td>2</td>
<td>00:47:49</td>
<td>(99) Name</td>
<td>TEAM</td>
<td>EST</td>
<td></td>
<td></td>
</tr>
输出应插入此处:
<div class="col col-md-5 px-5 pt-3" style="background-color:white;">
<div class="row">
<div class="col-12">
<h1 class="py-3">RESULTS</h1>
<div class="table-responsive">
<table class="table table-sm table-striped" style="table-layout: fixed;">
<thead>
<tr>
<th width="5%">Place</th>
<th width="10%">Time</th>
<th width="30%">Name</th>
<th width="15%">Team</th>
<th width="10%">Country</th>
<th width="20%" colspan="2"></th>
</tr>
</thead>
<tbody class="list results" id="results">
///***THE RESULTS SHOULD BE APPEAR HERE***///
</tbody>
</table>
</div>
</div>
</div>
</div>
以某种方式仅显示表格的最后一行。为什么?
感谢您的帮助:)
答案 0 :(得分:0)
通过用<th>
包装<tr>
元素开始工作