There is a very nice, browser independent method to do this:
1. Create a synchronous AJAX call
2. On the server side call the "sleep( [sec] )" function
To speak in code, this is the javascript (jQuery) part of it:
function pause(millisec) { jQuery.ajax({ type: "GET", url: "index.php", data: { task: 'pause', pauseMillisec: millisec }, async: false }); }
And this is the PHP part:
<?php if( $_GET["task"] == "pause" ) { sleep( $_GET["pauseMillisec"]/1000 ); } ?>
That's all folks.. isn't it easy? :)
Feel free to share your thoughts with me.
No comments:
Post a Comment