how to handle php variable in java script

0 votes
82 views
asked Jan 20, 2013 in HTML by BasicQuestion (1,355 points)
edited Jan 20, 2013 by BasicQuestion

I want to use php variable in java script..

i need a sample code for that

1 Answer

0 votes
answered Jan 21, 2013 by anonymous

use this sample....

 

<script>
  var Var = <?php echo json_encode($phpVar); ?>;
</script>
...