From: FAQ server on 9 Nov 2009 19:00 ----------------------------------------------------------------------- FAQ Topic - How do I get a jsp/php variable into client-side javascript? ----------------------------------------------------------------------- Use the server-side language to generate the javascript: // JSP var jsvar = "${ jspVar }"; // PHP var jsvar = "<?php echo $phpVar ?>"; If the string contains a quote mark, it will have to be escaped. If the an inline-script tag is used, and the string must not contains characters such as ` < `, ` > `, ` & `. The complete comp.lang.javascript FAQ is at http://jibbering.com/faq/ -- The sendings of these daily posts are proficiently hosted by http://www.pair.com.
|
Pages: 1 Prev: Identifier like "_", "$", etc. Next: IE/FF XHR multi-file upload |