I need to write PHP code inside Javascript " document.write()". This is a dummy example, but in the future, Javascript will automatically generate this PHP code.
This is the Hello World that I encoded:
Myfile.php
<html>
<body>
<script type="text/javascript">
document.write("<?php echo \"Hello World\"; ?>");
</script>
</body>
</html>
However, nothing is displayed, and in the DOM file I get the following:
<html>
<body>
<script type="text/javascript">
</script>
</body>
</html>
Any help? Thanks
source
share