C# Document.ready无法在我的登录页面上工作

C# Document.ready无法在我的登录页面上工作,c#,javascript,asp.net-mvc,C#,Javascript,Asp.net Mvc,因此,我有了这个登录页面(见下面的代码)和Document.ready不工作。剧本里有问题吗?我的代码中是否有什么东西会使文档.ready无法正常工作 我试图通过javascript中的警报消息进行检查,但它们从未被击中 @model OpenRoad.Web.Areas.Account.Models.LogOnModel @using Combres.Mvc <!doctype html> <!--[if lt IE 7 ]> <html class="no-js

因此,我有了这个登录页面(见下面的代码)和
Document.ready
不工作。剧本里有问题吗?我的代码中是否有什么东西会使
文档.ready
无法正常工作

我试图通过javascript中的警报消息进行检查,但它们从未被击中

@model OpenRoad.Web.Areas.Account.Models.LogOnModel
@using Combres.Mvc
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>@string.Format("{0} - {1}", OpenRoad.Web.ApplicationSettings.Title, "Logon")</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="/Content/images/favicon.ico" />

@Html.CombresLink("siteCss")
<link rel="stylesheet" type="text/css" href="@Url.Content("~/App_Themes/" +       OpenRoad.Web.ApplicationSettings.Theme + "/styles.css")" />    
 </head>
 <body class="login">

@{
     ViewBag.Title = "Log On";
}
@section scripts {
<script type ="text/javascript">
    $(document).ready(function () {
        alert('test');
        mixpanel.track("View Logon");
        if ($(".validation-summary-errors")[0]) {
            alert('Found with Length');
        };
    });
 }   
</script>
@model OpenRoad.Web.Areas.Account.Models.LogOnModel
@使用Combres.Mvc
@格式(“{0}-{1}”,OpenRoad.Web.ApplicationSettings.Title,“Logon”)
@Html.CombresLink(“siteCss”)
@{
ViewBag.Title=“登录”;
}
@节脚本{
$(文档).ready(函数(){
警报(“测试”);
mixpanel.track(“查看登录”);
如果($(“.validation summary errors”)[0]){
警报(“发现长度”);
};
});
}   

假设您的_Layout.cshtml有以下内容:

     @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>
@Scripts.Render(“~/bundles/jquery”)
@RenderSection(“脚本”,必需:false)

将@section scripts更改为@section scripts

我看不到包含jquery。是否加载了jquery库?此页面是否使用您的
\u Layout.cshtml
页面作为布局?如果您查看登录页面的来源,jQuery文件是否在完整的
标记中?只是在本地测试了我的答案,我的建议不是问题,所以我删除了答案。事实上,这就是问题所在。我意识到这个页面没有加载,因为itt没有使用相同的布局。如何将其添加到此html中?