我想每 5 秒刷新一次表..
现在我正在使用这段代码:
<script type="text/javascript">
$(document).ready(function(){
refreshTable();
});
function refreshTable(){
$('#content').load('refresh_data_dapur.php');
setTimeout(refreshTable, 5000);
}
</script>
refresh_data_dapur.php
$sql = "select t.no_meja, d.nama_menu,d.jumlah,t.status from detail_transaksi d join transaksi t on(d.id_transaksi=t.id_transaksi) where t.status ='pending' and d.status_menu = 'pending'";
$result = mysql_query($sql);
echo '<table cellpadding="5" cellspacing="0" border="1">';
echo '<tr>';
echo '<th>No Meja</th>';
echo '<th>Nama Menu</th>';
echo '<th>Jumlah</th>';
echo '<th>Status</th>';
echo '</tr>';
while($detail_transaksi = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td>';
echo $detail_transaksi['no_meja'];
echo'</td>';
echo '<td>';
echo $detail_transaksi['nama_menu'];
echo '</td>';
echo '<td>';
echo $detail_transaksi['jumlah'];
echo '</td>';
echo '<td>';
echo $detail_transaksi['status'];
echo '</td>';
echo '</tr>';
}
在我的html中:
<div id="content">
</div>
当我尝试加载页面时,它没有显示任何内容...
当我在 html 中修改成这段代码时,它显示了数据,但表格仍然没有刷新......
<div id="content">
<?php include("refresh_data_dapur.php");?>
</div>
我怎样才能解决这个问题?