<?php $php_var = "This is used to change php values to js"; ?> <script> var js_var = '<?php echo $php_var ;?>'; document.write(js_var); </script>