jQuery的JS库在本地运行项目时提示无法加载

最近公司有个项目在我本地运行时引用本地的jquery.js,浏览器提示无法加载

<script src="/js/newperson/jquery-1.11.3.min.js" type="text/javascript"></script>

但引用网络JS则可以正常使用

<script src="http://www.wodexiangce.cn/js/jquery-1.11.3.min.js" type="text/javascript"></script>

网上找了找这种问题的解决方法,没找到具体的原因,由于时间限制,没有继续深入了解,直接使用了网络JS。

这里记录下引用网络JS的几种方式:

1、直接使用外部库

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

2、局域网引用JS库

<script type="text/javascript" src="${pageContext.request.contextPath}/script/easyUI/jquery-1.4.4.min.js"></script>

3、jQuery库外部引用无法加载时自动加载本地jQuery库

Google jQuery库加载代码:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/jquery.min.js">x3C/script>')</script>

Microsoft jQuery库加载代码:

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js"></script> 
<script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/jquery.min.js">x3C/script>')</script>

SAE jQuery库加载代码:(国内新浪Sae提供的jQuery库)

<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/jquery.min.js">x3C/script>')</script>
原文地址:https://www.cnblogs.com/wbxk/p/6281902.html