Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:25:38+00:00 2026-06-15T07:25:38+00:00

I want to refresh my table every 5 seconds.. Now I’m using this code

  • 0

I want to refresh my table every 5 seconds..

Now I’m using this code:

<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>';
                    }

in my html :

<div id="content">

</div>

When I try to load the page, it doesn’t show anything…

When in the html I modify into this code, it shows the data but the table still isn’t refreshing…

<div id="content">
    <?php include("refresh_data_dapur.php");?>
 </div>

How can I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:25:39+00:00Added an answer on June 15, 2026 at 7:25 am

    Everything is fine here. but you are using setTimeout(refreshTable, 5000);. It will run the refreshTable function once after 5 seconds of page load. You should be using

    setInterval(refreshTable, 5000);
    

    instead. That will run every five second and keep it outside and after refreshTable function because you are using it in setTimeout before it is declared. That might be the cause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to refresh a table using a SSIS package every time the user
I want to submit a form without page refresh using jQuery. I found some
i just want to find out the name of this grid to refresh it.
I want to do something like this. while pressing the refresh button, it will
It takes about 5-10 minutes to refresh a prepared reporting table. We want to
I want to refresh datatable using new data in json format. I tried using
I want to be able to refresh the page every 2 minutes so that
I have a rich:extendedDataTable inside a rich:tab . I want to refresh the table
I want to refresh Google Map and send new geolocalization request without refreshing the
I have couple of formulas and data coming from database. I want to refresh

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.