Archive

Posts Tagged ‘JavaScript’

Embed php into Javascript

February 24th, 2009 No comments

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>

Read more…

VN:F [1.9.11_1134]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.11_1134]
Rating: 0 (from 0 votes)