[Solved] Javascript in php not working? [closed]


Your header() in code block 2 is calling for plain text. You should set this to a Javascript or HTML type output. Use one of the following header() calls instead.

If you have javascript AND html in the output:
header('Content-Type: text/html');

If your output is javascript ONLY (no html tags):
header('Content-Type: application/javascript');

1

solved Javascript in php not working? [closed]