在线加载jQuery.js时,代码可以工作,但是在本地加载jQuery.js时,它会失败 [英] Code works when loading jQuery.js online, but locally loading jQuery.js it fails

查看:109
本文介绍了在线加载jQuery.js时,代码可以工作,但是在本地加载jQuery.js时,它会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在在线加载jQuery时有效,但是在使用本地jquery.js文件时无效.我的本地jquery.js文件是最新的,并且是从Web加载的文件.
为什么?真令人沮丧.

我正在使用VS2010

这是我的脚本标签:

My code works if it loads jQuery online, but it doesn''t if using the local jquery.js file. My local jquery.js file is up to date and the same one that is loaded from the web.
Why? It is so frustrating.

I am using VS2010

Here are my script tags:

<script type="text/javascript" src="Scripts/jquery-latest.pack.js"></script>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>

推荐答案

要使用本地脚本URL进行测试,请尝试以下操作:
For your test with the local script url please try this:
<script type="text/javascript" src="./Scripts/jquery-latest.pack.js"></script>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>


仅当您还使用本地html文件并且时,此方法才有效,该目录包含浏览器中显示的html文件,并且该目录还包含一个名为"Scripts"的子目录,其中的jQuery-latest.pack.js位于它.

最好的问候,
曼弗雷德(Manfred)


This will work only if you are also using a local html file and the directory which contains the html file displayed in the browser also contains a subdirectory called "Scripts" with the jQuery-latest.pack.js in it.

Best Regards,
Manfred


这篇关于在线加载jQuery.js时,代码可以工作,但是在本地加载jQuery.js时,它会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆