Jump to content

Using countdown timers?


Usarjjaco

Recommended Posts

Hello guys,Just wondering if it's possible to have something where a user submits a form (In this case it's learning a skill) and then have that skill take X amount of time before they learn it... a countdown timer if you will.. would like something that can visually display to the user on the front end. Any and all help would be appreciated :)Thanks,JJ

Link to comment
Share on other sites

There are several parts to that, the countdown timer would be done in Javascript for example, and you would want to use ajax to set the timer and then when it's finished check to make sure that it's actually done according to the date in the database. It's easiest to set a timestamp in the database when the action begins and then use that to know when they started, and then how much time is left.

Link to comment
Share on other sites

There are several parts to that, the countdown timer would be done in Javascript for example, and you would want to use ajax to set the timer and then when it's finished check to make sure that it's actually done according to the date in the database. It's easiest to set a timestamp in the database when the action begins and then use that to know when they started, and then how much time is left.
Ok; so just set it so the submit script sets a new current timestamp in the row; and then use javascript / ajax to create the countdown timer.. and then when the timer reaches 0 it activates a mysql query to update their skill level?
Link to comment
Share on other sites

When the timer reaches zero you would want to send another ajax request to make sure the time has actually passed and the user hasn't just modified the timer, so you would still check with the database before telling them that the timeout is over. If they happen to close their browser window during the timer, the next time they log in you would just check to see if there are any timestamps that have expired since the last time and give credit for those.

Link to comment
Share on other sites

When the timer reaches zero you would want to send another ajax request to make sure the time has actually passed and the user hasn't just modified the timer, so you would still check with the database before telling them that the timeout is over. If they happen to close their browser window during the timer, the next time they log in you would just check to see if there are any timestamps that have expired since the last time and give credit for those.
Ok;I'm gonna go read up on ajax right now. Thanks for the help. On a seperate but equally important note... does anyone have any pointers or know of any decent tutorials for making a interactive map? Simple and 2d but on a hover over it will give the grid coordinates?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...