I was working for making multilanguage site in cake php, How do i include php variable inside jquery in cake php
1 に答える
0
You can't merge them directly...because when javascript is executed by any browser...the php code is already executed...all you can do is set a value from php variable to js by echo..
This is a small example:
<?php
$a = 2;
?>
<script type="text/javascript">
var value =<?php echo $a; ?>;
// it prints var value =2; in your browser ...so...
// do some stuff with value in js....
</script>
于 2013-03-25T09:27:36.590 に答える