I have to execute javascript that's written inside a .php file. I do understand that javascript is client side and php is server side language and I'm not supposed to be doing this but that's the project guidelines and hence I have to do it.
Issue: Whenever I load my php file from localhost( I'm using Apache on Mac), the javascript functions do not work. I know the code is correct as it works fine when the same js code is within an html file. I have tried writing js code in <script>.....</script>
and <?php echo" <script>...</script>"?>
but neither seem to work and I'm not permitted to use JQuery either. Entire code has to be within one php file. I have searched throughout stack overflow and all I have seen so far is to use <script>.....</script>
and <?php echo" <script>...</script>"?>
and they're not working. The html and css in the same file work properly.
Any help on how to solve is much appreciated. Thank you!