jQuery(document).ready(function() {
function updateTime() {
$("#wtime").append('<p>Wacht nog: <?php echo $wait_time; ?></p> ');
}
updateTime();
setInterval(updateTime, 1000); });
I want to update the div #wtime every second now it only shows the time and is not updating it
You have to parse the time you get from the server into a javascript
Date()object and then increment that each second.Here’s a working fiddle:
Related HTML:
Hope it helps.