General Doom Posted April 22, 2011 Posted April 22, 2011 Hey all, I am trying to get time to count down dynamically (no need to refresh page) instead of statically, but just can't figure it out for the life of me. Basically when somone adds something to the construction que it calculates the time to build it in seconds (lets say 3600 seconds) and put's it into the database: time()+3600 etc, then, when I use a function to turn this into hours mins seconds etc and display it on the construction page and it "counts down" but only when the user refreshes the page. Is there a way using JS or jQuery to make this dynamic? Just the displaying of the time? Hope I explained this well enough! Quote
Djkanna Posted April 22, 2011 Posted April 22, 2011 http://makewebgames.io/showthread.php/38968-jQuery-Second-Minute-Countdown. Quote
Dave Posted April 22, 2011 Posted April 22, 2011 Ironic that I just spent ages trying to find that thread for a project of my own! Quote
a_bertrand Posted April 22, 2011 Posted April 22, 2011 Well just tried "Countdown" in the search in the thread mentioned came 2nd. Quote
General Doom Posted April 22, 2011 Author Posted April 22, 2011 Okay, so i havn't looked at or used jQuery before, so how do I get that to take the input from the database as a timestamp? Also, can't seem to get it to countdown =S Quote
Djkanna Posted April 22, 2011 Posted April 22, 2011 Well just tried "Countdown" in the search in the thread mentioned came 2nd. Moral of the story, search people search... :P Okay, so i havn't looked at or used jQuery before, so how do I get that to take the input from the database as a timestamp? Also, can't seem to get it to countdown =S Well you need to include jQuery. Then it all depends on which version of the code on that topic you are using. Quote
General Doom Posted April 22, 2011 Author Posted April 22, 2011 Sorry for highly noobish questions! using the first version and have downloaded and included jquery into it, still no countdown. Quote
General Doom Posted April 22, 2011 Author Posted April 22, 2011 Nevermind, have it working now. So, how do I get the data from the database and put it into the JS? Im using PHP and mySQL for the rest of the script if that changes / help? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.