Click to See Complete Forum and Search --> : Var transfer from PHP to JavaScript


gebezis
06-25-2005, 09:39 PM
Is there a way to transfer the value of a variable from php to a JavaScript variable in a same document. I tried this but it gives JScript error....

<?php

$a = 1;

echo "
<script language='JavaScript'>
<!--
var a = ' " . $a . " ';
-->
</script>";
?>

SpectreReturns
06-26-2005, 12:45 AM
There's uh, nothing wrong with that code. What JS error did you get?