当我尝试加载 jquery 脚本(位于代码底部)时,我收到错误,以便使用表单验证运行我的c#应用程序。我相信我的脚本顺序正确,一旦加载页面,所有软件包也会显示在我的源代码中。我的版本如下。关于如何解决错误的任何想法?
“jquery”:“2.1.4”, “jquery-validation”:“1.15.0”, “jquery-validation-unobtrusive”:“3.2.4”
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MEC - Creative Naming Convention</title>
<base href="/">
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link href="~/lib/angularjs-toaster/toaster.css" rel="stylesheet" />
<link href="~/lib/angular-ui-grid/ui-grid.css" rel="stylesheet" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>
</head>
<body>
<script src="~/scripts/main.js"></script>
<script src="~/lib/requirejs/require.js"></script>
<div class="navbar navbar-custom navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="/home" class="navbar-brand" target="_self"><img src="~/images/grouplogo5.png" /></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/home" target="_self">Home</a></li>
<li><a href="/creative" target="_self">New Creative Name</a></li>
<li><a href="/creative/existing" target="_self">View Existing Creatives</a></li>@*"*@
</ul>
@await Html.PartialAsync("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© 2016 - CreativeNamingConvention</p>
</footer>
</div>
<environment names="Development">
<script src="~/scripts/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="~/scripts/site.min.js" asp-append-version="true"></script>
</environment>
<script type="text/javascript" src="~/lib/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script type="text/javascript" src="~/lib/jquery-validation/dist/additional-methods.js"></script>
<script type="text/javascript" src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
@RenderSection("scripts", required: false)
</body>
</html>
答案 0 :(得分:0)
我想出了答案!您必须将jquery脚本放在requirejs脚本之前,它才能解决问题!