Hello HashCode, I decided to connect the library to a php file, but for some reason it cannot connect it, here is the code.

<?php session_start(); include("../config.php"); ?> <html> <head> <script src = "../typer.js"></script> <script src = "../engine.js"></script> <link rel = "stylesheet" type = "text/css" href = "../style.css" /> <title>Кобинет модератора</title> </head> <body id = "container"> <style> #back{ background-color: gray; opacity: 0.4; } #back:hover{ opacity: 1; } </style> <center> <div id = "back"> <input type = "submit" class = "button" value = "Список пользователей" onclick = "showAllUser()"/> </div> </center> <div id = "allUser"> <b>БЛА БАЛАЩЛАЩАЬ</b> </div> </body> </html> 

Here is the JS code

 $(document).ready(function(){ $('#allUser').hide(1); }); 

So if I insert this JS code into the php code itself between the <script> </ script> tags, then everything works, but when I put it into a separate file, nothing works. I checked the file in the folder there.

  • maybe something messed with the way? point abs. path, for example - src = '/ assets / file.js' - pavelbel
  • No, everything seems to be fine, the file is in the root ... - Angus123
  • if in the root ../ probably too much - zhekonya
  • Yes, and the file is not in the root, it is in the control folder. - Angus123
  • then /control/file.js - pavelbel

2 answers 2

Then save the file like this:

 <script> $(document).ready(function(){ $('#allUser').hide(1); }); </script> 

And try to connect, in php usually when you do include , if in the file that we connect, the php code is not listed in the <?php ?> Tag, then an error is displayed, although we will connect it inside <?php ?> .

  • of course, the lower part of the answer does not apply to the question, but still to know) - webDev_

Everything is checked instantly.

In the browser, click "page view", as a rule, all browsers highlight the path. Click on the link

 <script src = "../typer.js"></script> 

and the browser requests the script file itself. and here we are already looking at whether the js file is shown, if it is not shown, then it writes why it could not show — and if it does, the problem is not there.

By the way, why did you decide that it does not connect?