theITvideos Posted November 15, 2010 Share Posted November 15, 2010 Hi there, I am working on a php web form. I have a variable named $isFruit having value of 1 When I do a: print_r($isFruit) It gives me value as 1, which is good. Now I need to pass this php variable into a jquery function: $('document').ready(function() { //I need to get the value of $isFruit variable here } How can pass the php variable into this function. Kindly reply. All comments and feedbacks are always welcomed. Thank you! Quote Link to comment Share on other sites More sharing options...
TrueColors Posted November 15, 2010 Share Posted November 15, 2010 <?php $isFruit = "some var"; ?> <script type="text/javascript"> $(function() { alert("<?php echo $isFruit; ?>"); } </script> Should do the trick. 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.