TripleDES Posted June 28, 2008 Share Posted June 28, 2008 If I store a variable in $date= $_POST['date']; How do I go about using it in a javascript? { var myAjax = new Ajax.PeriodicalUpdater('date', 'rand.php', {method: 'post', frequency: 5.0, decay: 1}); } Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted June 28, 2008 Share Posted June 28, 2008 You can use; <?=$date?> or; <?php echo $date; ?> -- DJ Quote Link to comment Share on other sites More sharing options...
TripleDES Posted June 28, 2008 Author Share Posted June 28, 2008 Thanks, but I still can't get it to work: { var myAjax = new Ajax.PeriodicalUpdater('date', <?=$date?>, {method: 'post', frequency: 5.0, decay: 1}); } Quote Link to comment Share on other sites More sharing options...
TripleDES Posted June 28, 2008 Author Share Posted June 28, 2008 Simple example: <script> var test = "<?php echo date.php;?>"; function myDate() { var myAjax = new Ajax.PeriodicalUpdater('date', test, {method: 'get', frequency: 2.0, decay: 1}); } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.