Jquery运行时错误$ undefined显示在本地加载时,但如果我指定完整路径或从CDN加载,则工作正常 [英] Jquery runtime error $ undefined showing when loading locally , but works fine if I specify full path or loaded from CDN

查看:105
本文介绍了Jquery运行时错误$ undefined显示在本地加载时,但如果我指定完整路径或从CDN加载,则工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中引用jquery的方式似乎存在一些问题(Asp .NET c-#)





$(document).ready(function(){

alert(welcome);

})







我的尝试:



我已经尝试了下面给出的所有选项
src =〜/ jquery-2.2.4.min.js
src =../ jquery- 2.2.4.min.js
src =/ jquery-2.2.4.min.js

但如果我指定完整路径,如
src =C :\ Users\\\
ame \Desktop\RCB\RCB\jquery-2.2.4.min.js

它工作正常..





我尝试创建另一个项目并试图做同样的事情,它工作正常。我无法弄清楚是什么问题?

解决方案

(文件).ready(function(){

alert(welcome);

})







我尝试过:



我已经尝试了下面给出的所有选项
src =〜/ jquery-2.2.4.min.js
src =../ jquery-2.2.4.min .js
src =/ jquery-2.2.4.min.js

但如果我指定完整路径,如
src =C:\ Users \\ \\ name\Desktop\RCB\RCB\jquery-2.2.4.min.js

它工作正常..





我尝试创建另一个项目并尝试做同样的事情,它工作正常。我无法弄清楚是什么问题?


< blockquote>尝试

< script src =jquery-2.2.4.min.js>< / script> 



简单的方法是打开aspx页面,将js文件拖放到页面的标题部分。它将负责参考。


There seems to be some problem in the way i'm refering jquery in my Project(Asp .NET c-#)


$(document).ready(function () {
alert("welcome");
})



What I have tried:

I have tried all the options given below
 src="~/jquery-2.2.4.min.js"
 src="../jquery-2.2.4.min.js"
 src="/jquery-2.2.4.min.js"

But if i specify the full path like
src="C:\Users\name\Desktop\RCB\RCB\jquery-2.2.4.min.js" 

it works fine..



I tried creating another project and tried to do the same thing as above and it works fine.I'm not able to figure out what is the problem?

解决方案

(document).ready(function () {
alert("welcome");
})



What I have tried:

I have tried all the options given below
 src="~/jquery-2.2.4.min.js"
 src="../jquery-2.2.4.min.js"
 src="/jquery-2.2.4.min.js"

But if i specify the full path like
src="C:\Users\name\Desktop\RCB\RCB\jquery-2.2.4.min.js" 

it works fine..



I tried creating another project and tried to do the same thing as above and it works fine.I'm not able to figure out what is the problem?


try

<script src="jquery-2.2.4.min.js"></script>


simple way is to open the aspx page, drag and drop the js file into the header section of the page. it will take care of the reference.


这篇关于Jquery运行时错误$ undefined显示在本地加载时,但如果我指定完整路径或从CDN加载,则工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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