how to stop parent function
Hi,
how run stop functions in time.php file?
-
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script>$(document).ready(function(){
var time_ref2 = setInterval(function()
{
$('#time_now').load('time.php?id='+ Math.random());
}, 1000);
});
</script>
</head> <body> <div align="center" id="time_now">--:--:--</div>
</body> </html>
time.php:
-
<?php
$sec = date("s");
echo $sec;
?>
<script>$(document).ready(function(){
<?php
if($sec == "30"){ ?>
var stop = setInterval(function()
{
clearInterval(time_ref2);
}, 2000);
<?php } ?>
});
</script>