Answers for "connect php to js"

PHP
0

link js file in php

PHP is completely irrelevant for what you are doing. The generated HTML is what counts.

In your case, you are missing the src attribute. Use

 <script type="text/javascript" src="file.js"></script>
Posted by: Guest on July-14-2021
0

php into javascript

$str = <<<MY_MARKER
<script type="text/javascript">
  document.write("Hello World!");
</script>
MY_MARKER;

echo $str;
Posted by: Guest on May-21-2021

Browse Popular Code Answers by Language