Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot find js file

I have stucture code like this:

enter image description here

I try to load javascript into php file like this:

enter image description here

But i have an error like this: enter image description here

This is my html : enter image description here

And this is another javascript:

enter image description here

And i try to copy paste the link, and i got an error 404 not found. How can i fix it? Thanks.

like image 697
user3505775 Avatar asked Dec 25 '22 11:12

user3505775


1 Answers

Permissions

When the host is correct, and the file is in the right place, and you have no other networking problems, you may sometimes still get a 404 because of bad file permissions. If a server does not have permission to access a file, it may send out a 404 error in response. The reason why some "Not Authorized" error is not given instead, is that this would reveal more information about the files than you, the owner of the server, may intend. The way to respond to requests for privileged files without revealing whether or not they exist is to give a 404.

On Windows, you can view and change the permissions from the File Explorer by right-clicking on the file or folder, then going to Properties -> Security -> Edit. For more information, see the notes on permissions on Microsoft's site.

File Types

Besides permissions, a server must also be configured to serve the type of file you are accessing. If files with different extensions are served, but .js files are not, check the configuration of your server to make sure that .js files aren't blacklisted (or not whitelisted, as the case may be).

Directory Location

You should also verify that the files are actually stored in the top-most directory of the web server if that's how you are accessing them. If they aren't, you may need to prefix the path with the path from the webserver root to your application directory. E.g., instead of fusioncharts/..., you may need /path/to/fusioncharts/... or ../../path/to/fusioncharts.

Other Considerations

In your particular case, you should also verify that the files inside the fusioncharts folder are actually structured the way you think. (E.g., is there really a js/[insert name here].js file inside the fusioncharts folder?

If none of that solves your problem, try to take something that is working and gradually make it more and more similar to the files that aren't working. By figuring out at which point you go from a working setup to a not working setup, you may discover the problem.

like image 162
Chris Middleton Avatar answered Dec 27 '22 04:12

Chris Middleton