How to execute PHP from Javavscript
Posted: Tue Feb 23, 2010 12:34 am
In the page with the JS you start an interval, and then point the src of another JS to your PHP page.
Then in "script.php" you print some javascript that will clear the interval at the end.
Code: Select all
<script type="text/javascript">
var process = function()
{
do_stuff();
}
var processing = setInterval(process, 1000);
</script>
<script type="text/javascript" src="script.php"></script>
Code: Select all
<?php
do_stuff_in_php();
echo 'clearInterval(processing);';
?>