Can't load external javascript code |
Hello,
I'm trying to load an external javascript code inside a view from my project, but the browser can't find. The javascript is found on: localhost/diceroller/assets/js/script.js My index.php is found on: localhost/diceroller The load external javascript code is in my view: Code: <script src='<?php echo base_url("assets/js/script.js"); ?>' type='text/javascript' ></script> On Firefox, when I press F12 I found on console that say the following: Code: Falha no carregamento do <script> com a fonte “http://localhost:8080/diceroller/assets/js/script.js” As you can see, the script.js is on localhost/diceroller/assets/js/ but the browser can't find on that folder.
It states localhost:8080/diceroller/assets/js/script.js and not localhost/diceroller/assets/js/script.js so you need to make sure that's the correct url.
app.baseURL in .env if you have changed from the default url.
I changed the $baseURL inside Config/App.php to "http://localhost/diceroller/", restarted the xampp and did try again.
But the message only crop the 8080 from the message: Code: Falha no carregamento do <script> com a fonte “http://localhost/diceroller/assets/js/script.js”.
Hello, there is a print-screen from the project on the view/diceroller.php open to show the line that I load de file script.js and the browser could not find it.
To me it looks like index.php are inside assets folder. Hard to tell how those arrow points... Does your CSS load?
The CSS doesn't load also.
I put some lines in the picture to become easy to follow the directories.
Okay, still some odd looking indention. xD
So you get the CI Welcome message at: localhost/diceroller? Try moving around your CSS file to see where it's actually at. Start putting it in the root folder (localhost) and work from there. Can't really help you any further, as it's not physically there according to your sever. The only thing I can thing of are that you have incorrect permissions on that folder.
I'll try that today.
Move the file around to see if the browser check its contents.
Thanks.
It was missing the project name into base app directory into Config/App.php. It have to be looking into localhost/professionalsite/diceroller instead of localhost/diceroller. |
Welcome Guest, Not a member yet? Register Sign In |