Jump to content

setinterval


hasjem

Recommended Posts

i picked this up from the internet, it is simple, but not working. why not?

 

<div align="center" id="timeval">--:--:--</div>

<button id="stop">Stop</button>

 

<script src="jquery.js"></script>

<script>

$(document).ready(function()

{

  //ajaxTime.php is called every second to get time from server

  var refreshId = setInterval(function()

  {

    $('#timeval').load('ajaxTime.php?randval='+ Math.random());

  }, 1000);

 

  //stop the clock when this button is clicked

  $("#stop").click(function()

  {

    clearInterval(refreshId);

  });

});

</script>

 

and as ajaxtime.php:

 

<?php

  echo date("g:i:s A");

?>

and, yes, i uploaded jquery.js

 

what is wrong?

 

thanx

 

lex

Link to comment
https://forums.phpfreaks.com/topic/201619-setinterval/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.