php Programming Glossary: php_var
How can I pass a PHP variable to javascript? http://stackoverflow.com/questions/3658027/how-can-i-pass-a-php-variable-to-javascript session_id and use this as a javascript variable. php php_var session_id script language JavaScript type text javascript js_var.. language JavaScript type text javascript js_var php echo php_var script This seems like it should work for me but it doesnt can.. The best method i can think of looks like this php php_var session_id script type text javascript var js_var php echo json_encode..
Access PHP variable in JavaScript [duplicate] http://stackoverflow.com/questions/4287357/access-php-variable-in-javascript have to do something like script type text javascript var php_var php echo php_var script You can also load it with AJAX rhino.. like script type text javascript var php_var php echo php_var script You can also load it with AJAX rhino is right the snippet.. lacks of a type for the sake of brevity. Also note that if php_var has quotes it will break your script. You shall use addslashes..
|