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

  • Home
  • SEARCH
  • 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 8713999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:29:00+00:00 2026-06-13T05:29:00+00:00

I have a <div id=refresh> that has some MySQL content in it. I has

  • 0

I have a <div id="refresh"> that has some MySQL content in it. I has this JavaScript code for it:

<script type="text/javascript">
    var auto_refreshs_contents = setInterval(
        function(){
            $('#refresh').load('index.php?_=' +Math.random()+' #refresh').fadeIn("slow");  // load div.refresh
        }
    , 3000); // refresh every 3 seconds
</script>

It actually posts a duplicate of the code the first time so it would look like this:

    0 seconds
+-------------------------------------+
|Randome Text                         |
|This is such a cool chat room        |
|Not really                           |
+-------------------------------------+
    3 seconds
+-------------------------------------+
|Randome Text                         |
|This is such a cool chat room        |
|Not really                           |
|This is such a cool chat room        |
|Not really                           |
+-------------------------------------+

If you noticed that, It left out the post “Random Text”. I don’t know why.
But yeah, it basically does that the first time. Then after 6 seconds, it refreshes, but doesn’t more content, after that, it refreshes right. So I decided to clear the contents of the page right before refreshing it:

<script type="text/javascript">
    var auto_clearContents = setInterval(
        function(){
            $("#refresh").html(""); //clear contents of div#refresh
        }
    , 3000);  //clear existing contents every 3 seconds

    var auto_refreshs_contents = setInterval(
        function(){
            $('#refresh').load('index.php?_=' +Math.random()+' #refresh').fadeIn("slow");  // load div.refresh
        }
    , 3000); // refresh every 3 seconds
</script>

However thats when things get weird. I’m looking at the networks tab in Chrome Developers Tools and it’s showing that it refreshes every 200ms or so (yes 200) and sometimes it takes 2.5 seconds. I have no idea…

Is there something wrong with my code? Is there a better way to do it? Thanks!

  • 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-13T05:29:01+00:00Added an answer on June 13, 2026 at 5:29 am

    I think that there must be something wrong on the back end. Here is a fiddle showing basically just what you are saying and it’s working fine.

    When you see that 200ms, I think that is likely the time that it takes to generate the index.php page, not the time between intervals.

    If you show us the response from the php page or the php page itself we may be able to help.

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

Sidebar

Related Questions

I have div which has three buttons as, <div id=buttons> <input id=preview class=ButtonStyle type=submit
I have a div which contain lots of input[type=text] fields. I want to put
I have a div that expands to the height of it's content. It works
I have a news feed that has been developed using PHP, MySQL, and jQuery.
I have form on my page that has the following code <form class=form> ...
I assume this has a simple solution. I have a list that I want
I have the following code generating content on my site: <div class=content id=links> <?php
I'm using the script below to refresh a div when the text 'view more'
I have some code that when the page loads gets the height of an
I've the following Javascript code : <script> var auto_refresh = setInterval( function() { $('#loaddiv').load('tables.php');

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.