How to pass a PHP variable to JavaScript?

On this page we demonstrate and describe passing PHP variables containing simple data types to JavaScript. We demonstrate with string, boolean, and numeric values (i.e., scalar values). To pass scalar data held in a PHP variable ( $val) to a JavaScript variable, place the following in a JavaScript segment: Notice the quotes around the PHP tags.
For More Information Please Refer:

You May Also Like to Read: