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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:07:12+00:00 2026-06-05T14:07:12+00:00

I have never programmed in jquery. I’m using JQuery Countdown plugin for to have

  • 0

I have never programmed in jquery. I’m using JQuery Countdown plugin for
to have a countdown when i call a php page but the timer doesn’t restart.
I need to write a restart function to call by the ‘onExpiry’ event of the JQuery Countdown plugin. This is the script that i have on a html page.
I’m following this post :
Auto Restart/Reset countdown timer
but i think that the solution in that post doesn’t work because is about dates.
I need to restart for a random period of maximum 2 hours.
Thanks…..

$(document).ready(function () {
    function randRange() {
        var newTime = Math.floor(Math.random() * 30001) + 10000;
        return newTime;
    }

    function toggleSomething() {
        $('#timeval').load('ajaxTime.php?randval=' + Math.random());
        clearInterval(timer);
        lollo = parseInt(randRange());
        timer = setInterval(toggleSomething, lollo);
        $('#msg').fadeOut("slow").countdown({ *onExpiry:?????* until : +(lollo / 1000),
            format : 'HMS',
            layout : '<div id="timer">' + '<div class="timer_numbers">{hnn}:{mnn}:{snn}</div>' + '</div>'
        }).fadeIn("slow");
    }
    var timer = setInterval(toggleSomething, 1000);
});

EDIT:

I solved :

$('#msg').countdown({until: +(lollo/1000), onExpiry: function() { setTimeout(function() { $('#msg').countdown('change', {until: +((lollo/1000) - 1)}); }, 1000); }, format: 'HMS', layout:
    '<div id="timer">'+
        '<div class="timer_numbers">{hnn}:{mnn}:{snn}</div>'+
    '</div>'
    });

If anyone has a better solution please contact me pro-zac31[at]libero.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-05T14:07:14+00:00Added an answer on June 5, 2026 at 2:07 pm

    How about this:

    $(function() {
        function randRange() {
            return Math.floor(Math.random() * 30001) + 10000;
        }
    
        (function resetTimer() {
            $('#msg').fadeOut("slow", function() {
                $(this).countdown('destroy').countdown({
                    until: randRange() / 1000,
                    format: 'HMS',
                    layout: '<div id="timer">' + '<div class="timer_numbers">{hnn}:{mnn}:{snn}</div>' + '</div>',
                    onExpiry: resetTimer
                }).fadeIn("slow");
            });
        })(); //self-execute
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never programmed a gadget for Vista or Seven, but I would like
I have never thought about until recently, but I'm not sure why we call
I have never programmed VB, but a university course forcibly requires me to use
I have never programmed anything in php before and haven't touched html in 10
I've never programmed a game, but have about a dozen years programming interfaces. After
I've never programmed a game, but have about a dozen years programming interfaces. After
OK first of all, I am a PHP programmer but I have never done
I have never programmed in visual basic before and my boss just told me
I have web page with some really large tables that I'm filtering using some
I've never programmed in java or eclipse before, although I have used c# and

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.