'JQuery' 未定义 [英] 'JQuery' is undefined

查看:35
本文介绍了'JQuery' 未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个使用本地文件系统设置创建的 ASP.net 项目.我正在使用 MVC 和 Jquery.当我在调试模式下运行应用程序时,Jquery 工作正常,即在 ASP.net 开发服务器中.我正在尝试在 IIS 7 中托管应用程序.在托管模式下,它无法识别 Jquery 并给出脚本错误Jquery 未定义".脚本文件的位置在两种模式下都没有改变.任何人都可以知道可能是什么原因以及如何解决这个问题.

I am working on a ASP.net project created with local file system settings. I am using MVC and Jquery. Jquery is working fine when I run the application in debug mode i.e. in ASP.net Development server. I am trying to host the application in IIS 7. In hosted mode, it does not recognize Jquery and gives scripting error 'Jquery is undefined'. The locations of the script files is unchanged in both modes. Can anybody have any clue what can be the reason and how to solve this.

我的代码是这样的;

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>

<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>

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

<!-- YUI Styles -->
<link href="../../Content/reset.css" rel="stylesheet" type="text/css" />
<link href="../../Content/fonts.css" rel="stylesheet" type="text/css" />
<link href="../../Content/grids.css" rel="stylesheet" type="text/css" />
<!-- /YUI Styles -->
<link href="../../Content/knowledgebase.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    //this hides the javascript warning if javascript is enabled
    (function($) {
        $(document).ready(function() {
            $('#jswarning').hide();
        });
    })(jQuery);
</script>

<asp:ContentPlaceHolder ID="ScriptContent" runat="server" />

....

推荐答案

尝试使用 Firebug 'Net' 选项卡查看文件是否被加载.

Try using Firebug 'Net' tab to see if the file gets loaded.

您还可以将 Firebug 配置为在所有错误上都失败,并查看错误发生的时间与 jQuery 加载的时间.

You can also configure Firebug to fail on all errors and see when the error happens as compared to when jQuery gets loaded.

这篇关于'JQuery' 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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