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 8108435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:06:28+00:00 2026-06-06T01:06:28+00:00

I have a page that I want to update non stop, every few seconds.

  • 0

I have a page that I want to update non stop, every few seconds.

For this, I wrote the following:

var to;
$(function () {
           to = setTimeout(updateDivContent, 2000);
});

function updateDivContent() {

    $('#topbox').load('/home/blabla', null);


    $('#leftgraph').load('/home/blabla', null, function () {

        to = setTimeout(updateDivContent, 2000);
    });
};

This worked, however, it leads to what I presume is a memory leak as after around 15 minutes, the computer almost freezes up with the browser taking up all available memory and CPU.

I am guessing that the Timeout is basically stacking, but, I am not sure how to fix this. I have tried getting rid of the second timeout and putting the first one inside a while(true) loop, but, I just couldn’t get it to work.

Can anyone suggest anything?

  • 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-06T01:06:30+00:00Added an answer on June 6, 2026 at 1:06 am

    This looks fine actually. But if the first Ajax call does not finish within two seconds, it will stack, and this could (don’t know for sure) cause problems.

    The timeout itself does not stack, since you are initiating a new one only after the previous one finished.

    Try to initiate a new timeout once both Ajax requests finished:

    $.when($('#topbox').load('/home/blabla'),
           $('#leftgraph').load('/home/blabla')
    ).then(function () {
        setTimeout(updateDivContent, 2000);
    });
    

    Reference: $.when

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

Sidebar

Related Questions

I have a page that I want to be styled differently depending on whether
I have an aspx page that I want to convert to an HttpHandler ,
I have an HTML page that contains some filenames that i want to download
If I have a JSF page that I want to link to where I
I have a page that displays messages and I want it to work just
I have links on a ,page that I want to use to jump to
I have a page that displays posts and I want to get the name
I have a page that above it I want to have a panel that
i have a page that contains several submit buttons however i only want one
I have a section of an html page that I want to display in

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.