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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:02:23+00:00 2026-05-28T04:02:23+00:00

I have a full ajax application. i am using the below code to update

  • 0

I have a full ajax application. i am using the below code to update time every minute. But if i keep the browser open for >10 min the browser becomes non responsive/slow. Suggest a better code.

function tick()
{
    var d = new Date();
    var time = padNumber(d.getHours(),2)+':'+padNumber(d.getMinutes(),2);
    $('#WeatherBoLfTime').html(' '+time);
    t = setInterval('tick()',60000);
}

$(document).ready(function(){
    tick();
})
  • 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-05-28T04:02:24+00:00Added an answer on May 28, 2026 at 4:02 am

    The problem is that you’re calling setInterval many times and never clearing any of them. So after a while you have lots of interval callbacks running at around the same time.

    Change

    t = setInterval('tick()',60000);
    

    to

    t = setTimeout(tick,60000);
    

    When I first started out coding JavaScript I took down a Lycos web server with AJAX calls because I made the same mistake 🙂

    Note that since you’re displaying the actual time, you should use a much shorter timer than 1 minute. If I land on your webpage at 13:42:30, the time will not be updated until ~13:43:30. To keep it in sync with the machine’s time, you would probably want to set the timer for 1000.

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

Sidebar

Related Questions

We have an ASP.NET web application which uses ASP.NET Ajax. We open it from
In my application I have a login using ajax that returns a JSON result.
I have used full text search mysql. My code is select * from uh_property
I have a stupid problem. An jQuery.ajax request return me a full HTML text
I am developing web-application using Google Maps API and ASP.NET Ajax. Here is my
I keep getting this HttpMediaTypeNotAcceptableException error for AJAX requests when using with Spring MVC
I am implementing the Jquery UI autocomplete. I have the following code. Application.js $(function()
I have a classic ASP application I would like to add some AJAX-style partial
I have full weekly backups, daily differential backups and hourly transaction log backups. To
If I have Full Control permission on a list, is there a way for

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.