Fotiman

msg:4293738 | 4:52 pm on Apr 7, 2011 (gmt 0) |
Would something like this work? <?php srand ((double) microtime( )*1000000); $random_number = rand(1000,5000); echo "$random_number"; ?> <script> setTimeout(function () { window.location.reload(); }, 10000); // reload after 10 seconds </script>
|
| Or do you need to get this via AJAX?
|
jalarie

msg:4294620 | 3:20 pm on Apr 9, 2011 (gmt 0) |
If you did the coding in JavaScript instead of PHP, you could avoid both the reload and AJAX.
|
trader

msg:4294630 | 3:50 pm on Apr 9, 2011 (gmt 0) |
I am wondering what a random number with every page refresh could be used for?
|
deviss

msg:4304130 | 2:59 pm on Apr 26, 2011 (gmt 0) |
Hello sorry for my late response Thanks for your help Fotiman Unfortunately, the random number changes each page refresh. I don't want to do that. Even if i would refresh the page, that number should change after a certain time i set,like in your scrit 10 seconds for example. But your script refreshes it after 10 seconds automatically. But if i refresh the page manually it will show a different number every time i do that. Hope you can help me
|
Fotiman

msg:4304201 | 4:30 pm on Apr 26, 2011 (gmt 0) |
It sounds, then, that what you really need is some sort of cron job running on the server that will generate the value and persist it to a database or file which can then be read by your PHP script. It doesn't sound like a JavaScript issue, though, so you might try a forum that focuses on server side.
|
|