简体   繁体   中英

Javascript auto refresh div in table

I have a table with a div inside of it that auto loads every 10 seconds to add or remove rows. The issue I'm having is that it's not putting it in the table. It's putting the rows above the entire table.

<script>
var auto_refresh = setInterval(
function ()
{
$('#load_pilots').load('pilots.html').fadeIn("slow");
}, 10000);
</script>

The HTML

<div id="load_pilots">
      <?php $mining->activePilots(); ?>
</div>

the outcome of activePilots() is

<tr><td>Text</td><td>Text</td><td>Text</td><td>Text</td></tr> 

What I want to happen is the table rows go into the table, but instead they are going above the table and my browser has them as "stray tags."

EDIT: Some rows are static in the table, not adding the id to the table would not work because some rows stay there.

你必须给你的表 id 而不是 div 。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM