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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:53:37+00:00 2026-06-18T09:53:37+00:00

I am developing a small web application. I have pretty much finished the server

  • 0

I am developing a small web application.
I have pretty much finished the server side code, but am struggling with the client side javascript.

I have an html file that is updated every second. This file is fully static and I use it only for log purposes.

The idea is to do pretty much the same thing, but with an auto update done on the client side.

For that I want to use database polling using ajax.

I have implemented a first version here, that simply prints the same html file and is supposed to reload it every second.

The thing is that is doesn’t update, even though I don’t see any error in my javascript console client side.
The file is found, as it loads correctly and I don’t see any reason why it wouldn’t update my div.

Here is my code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- Using Google CDN -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script>
        (function worker() {
          $.ajax({
            url : 'http://jlengrand.pythonanywhere.com/static/leader.html',
            success: function(data) {
              $('.text').html(data);
            },
            complete: function() {
              setTimeout(worker, 1000);
            }
          });
        })();
    </script>
</head>
<body>
    <div class="text">
        To be loaded <br />
    </div>
</body>
</html>

I tried locally (but with a smaller file) and it worked fine.

I know that reloading the whole file is not clever, but I want to build incrementally as this is the first time I develop in JavaScript.

What am I missing?

  • 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-18T09:53:38+00:00Added an answer on June 18, 2026 at 9:53 am

    Error: useless setTimeout call (missing quotes around argument?)

    You run worker inside setTimeout. You need to remove () or you need to put it in ”:

    setTimeout(worker, 1000);
    

    or

    setTimeout('worker()', 1000);
    

    *Edit:
    To prevent caching, change url to:

     url : 'http://jlengrand.pythonanywhere.com/static/leader.html?rand='+Math.random(),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a small email web application in JSP/Javascript/html. It has a logout
I am developing a small web application optimized for iPad (using mainly javascript &
I was developing a small WAMP web application on my laptop, where I have
I am developing a small intranet based web application. I have YSlow installed and
I have been developing a small application in Python using the Web.py framework that
We're developing a data heavy modular web application stack with java but have little
I am looking into developing a small (read:rudimentary) web server on a linux platform
So I have been developing a small ASP.NET web app in C# for my
I am developing a small, internal-use only web application. Given its simple nature and
I am developing a very small survey application, likely 3-4 pages web application. so

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.