remaining time from db with no page refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • panos100m
    New Member
    • Aug 2007
    • 23

    remaining time from db with no page refresh

    hi in my php page i am showing to the user the remaining time untill an event occurs..
    I am reading the value from a database
    The problem is that he needs to refresh the page to get the correct time (for time to decrement) ...i can use a meta refresh but it doesn't look professiona, is there a way for the values to decrement without page refresh and if yes how? (can you please provide a code snip-set)
    The only way that i can think maybe is by using an ajax function that queries the db every now and then but i am not sure how to call it as you normally associate it with events (like onclick, onscroll) or how to associate a timer.. but this might be the wrong thought ..

    any help really appreciated!

    Thanks
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    You need to Ajax as you said. As far as calling this function is concerned, you can use setTimeout (example) to call this function after a specified time interval.

    Comment

    Working...