无法让 jquery 处理 php 文件
我有一个 Linux Web 服务器,在 Apache2.conf 文件中将 /var/www
配置为 DocumentRoot。接下来,我的 jquery 核心文件位于 /var/www/js/jQuery_v1.4.2.js
(我所有网站访问的中心位置。
.php
索引文件位于 /var/www/AOI/aoiparse.php
,其中 aoifunctions.js 文件也位于其中,我的 标记如下所示:
<script type='text/javascript' scr='/js/jQuery_v1.4.2.js'></script>
<script type='text/javascript' scr='aoifunctions.js'></script>
my aoifunctions.js 文件中包含以下内容,以便验证脚本链接是否有效:
$(document).ready(function(){
alert("hello");
});
我的问题是我无法让alert() 工作,所以我没有收到错误消息,所以我不知道问题出在哪里。 。
I have a linux webserver that has /var/www
configured in the Apache2.conf file as the DocumentRoot. Next I have my jquery core file located at /var/www/js/jQuery_v1.4.2.js
(a central location for all my websites to access.
The .php
index file is located at /var/www/AOI/aoiparse.php
, where the aoifunctions.js file is also located. My <head>
tag looks as follows:
<script type='text/javascript' scr='/js/jQuery_v1.4.2.js'></script>
<script type='text/javascript' scr='aoifunctions.js'></script>
my aoifunctions.js file has the following in it in order to verify that the script link works:
$(document).ready(function(){
alert("hello");
});
My problem is that I cannot get the alert() to work. I'm not getting an error message so I do not know where the problem is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试
(属性为 src< /strong>,不是 scr,加上你的路径不正确)
You can try
<script type='text/javascript' src='../js/jQuery_v1.4.2.js'></script>
(The attribute is src, not scr, plus your path was incorrect)
将 jquery 文件放入 /var/www/AOI/js/ 中,然后
删除第一个 / ,
使其位于主页的子目录中,
或者如果您想将其保留在原来的位置,请使用它:
put the jquery file in /var/www/AOI/js/ and then
remove the first /
so it lies in a subdirectory to your main page
or use this if you want to leave it where it is:
您在
标记中拼错了“src”。它是 Source 的缩写。
如果您使用 Firebug,您就可以轻松判断脚本尚未加载。
You misspelled "src" in your
<script>
tags. It's short for SouRCe.If you used Firebug you'd have been able to easily tell that the scripts weren't loaded.