K
K
KakNaZlo2018-04-26 13:02:01
JavaScript
KakNaZlo, 2018-04-26 13:02:01

How to include external js file in php file?

Good afternoon!
The thing is, I'm trying to change the 404 page. Now the content of the page is displayed like this prntscr.com/jacctm
in the $message field I insert my code and it is displayed, BUT the new page contains a search that works due to the script, and after inserting the script everything breaks and displays a blank page. I tried to escape the script code so that the machine would normally accept it, but nothing helps. I thought that maybe there is a way to connect this script from the outside? Or maybe you need to bring all this into php format and connect it as a .php file?
Once again: if you insert html code with css styles - it works fine, as soon as I add the script everything collapses.
I'll be glad for tips and ideas)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mrSeller, 2018-04-26
@mrSeller

Move the JS to a separate file and include it before the closing body tag:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question