<?PHP //code... $name = 'Имя'; ?> <script type="text/javascript"> var fileName = '<?=$name?>'; alert(fileName); </script>