Embed php into Javascript
by Samet Kilictas on Feb.24, 2009, under Jquery, PHP, Programming
In javascript you cannot read variables from a server instanly however if you embed your php code you may pass variables into javascript code.
So php can pass its variables when page loads. Here is an example using jquery
<?php $variable = 'Here is value'; ?>
<script type= "text/javascript">
$(document).ready(function(){
var button = <?php echo $variable; ?> ;
});
</script>
Keep Coding
No comments for this entry yet...
Thanks for dropping by! Feel free to join the discussion by leaving comments, and stay updated by subscribing to the 