jQuery not loading
I'm using php.
When I use the jquery-1.3.2-min.js on google's server, it loads and everything runs fine.
But when I try to use the one I downloaded to my server, Firebug gives me this:
1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2<html><head>
3<title>403 Forbidden</title>
4</head><body>
5<h1>Forbidden</h1>
6<p>You don't have permission to acce开发者_Go百科ss /path/to/scripts/jquery-1.3.2.min.js
7on this server.</p>
8<hr>
9<address>Apache/2.2.12 (Ubuntu) Server at localhost Port 80</address>
10</body></html>
How can I fix it? Do I have to change some settings in Apache.
The other thing is there is another js file (the one that uses the jquery) that loads just fine. It is in the same folder as the jquery-1.3.2.min.js (i.e. in the scripts folder).
Sounds like a permissions issue on the file itself. Try
chmod 755 /local/path/to/jquery-1.3.2.min.js
I just had a very similar thing happen. What fixed it for me was taking the file that wasn't working and copying the content of the file into a new file. E.G. In my instance, take the JQuery file, open it, copy into a new JS file, save, move old file, put new file in same place with same name... then it all worked fine.
You need to check your users permissions with regards to those directories/files. Consider contacting your host about this issue if you are unable to resolve it yourself.
If apache can read one file but not the other. Check the permissions on the file use chmod or chown and see if that makes a difference. Set the file to the same permissions of the other javascript file that loads fine.
Apart from checking permissions, prefix the path with this and then see:
$_SERVER[DOCUMENT_ROOT];
If the suphp module is enabled in apache you have to adjust the permissions and the owner of the jquery file. Take a look at the permissions of the files with
cd /path/to/scripts
ls -l *.js
if the permissions are different you can adjust the permissions of the jquery-1.3.2.min.js file with e.g.
chmod 664 jquery-1.3.2.min.js
and if the owner is different you can adjust it with
chown user:group jquery-1.3.2.min.js
This solution won't fix your permissions issue, but it's better to load the jQuery library from Google.
Google host several popular JS libraries.
The main advantage is that many people already loaded the file from Google, so they already have it in cache. This way, you save a lot of bandwidth, and pages load faster for most of your visitors.
You can just use this URL to include the api. (more info)
http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js
精彩评论