Refresh Page or Update Div (ajax) at Given Time

All about creating websites!
Post Reply
User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Refresh Page or Update Div (ajax) at Given Time

Post by maboroshi »

Trying to figure out a way to update a page or div when a certain date time is reached and transition if/when the next time is reached.

Code: Select all

<script>
window.setInterval(function(){
    var current = new Date("{{=str(current_time)}}");
    var start_t = new Date("{{=str(start)}}")
    if(current.getTime()==start_t.getTime()){
                  window.location = location.href;
      }
}, 5000);
</script>
The current time and start time are in UTC Format atm (if that matters for the jquery code). I will eventually make them for the local time of the client.

Any Ideas?

*cheers

mabo

Post Reply