gpt4 book ai didi

jquery - MVC万无一失的验证 'Sys is not defined'

转载 作者:行者123 更新时间:2023-12-01 01:07:18 27 4
gpt4 key购买 nike

我使用包管理器控制台安装了这两个包:foolproof 和 MvcExtentions.Foolproof。我将万无一失的脚本文件包含在我的捆绑配置中(见下文)。

请注意,我还没有实现任何万无一失的代码,我只安装了软件包并包含脚本文件,然后运行应用程序。

我收到以下客户端错误:

MvcFoolproofValidation.js: Uncaught ReferenceError: Sys is not defined

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*",
"~/Scripts/MvcFoolproofJQueryValidation.js",
"~/Scripts/mvcfoolproof.unobtrusive.js",
"~/Scripts/MvcFoolproofValidation.js"));

呈现为:(如果有任何后果)

<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery-ui-1.10.3.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/MvcFoolproofJQueryValidation.js"></script>
<script src="/Scripts/mvcfoolproof.unobtrusive.js"></script>
<script src="/Scripts/MvcFoolproofValidation.js"></script>

最佳答案

问题是因为顺序不正确。我遇到了同样的问题,但我决定执行此命令:

捆绑:

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js",
"~/Scripts/jquery.validate.min.js",
"~/Scripts/jquery.validate.unobtrusive.min.js",
"~/Scripts/blur.js"));

bundles.Add(new ScriptBundle("~/bundles/mvcfoolproof").Include(
"~/Scripts/MicrosoftAjax.js",
"~/Scripts/MicrosoftMvcAjax.js",
"~/Scripts/MicrosoftMvcValidation.js",
"~/Scripts/MvcFoolproofJQueryValidation.min.js",
"~/Scripts/MvcFoolproofValidation.min.js",
"~/Scripts/mvcfoolproof.unobtrusive.min.js"));

View :

@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/mvcfoolproof")

渲染:

 <script src="/Scripts/jquery-ui-1.11.1.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/MicrosoftAjax.js"></script>
<script src="/Scripts/MicrosoftMvcAjax.js"></script>
<script src="/Scripts/MicrosoftMvcValidation.js"></script>
<script src="/Scripts/MvcFoolproofJQueryValidation.min.js"></script>
<script src="/Scripts/MvcFoolproofValidation.min.js"></script>
<script src="/Scripts/mvcfoolproof.unobtrusive.min.js"></script>

然后......问题就消失了。

查看文档检查此订单 here .

关于jquery - MVC万无一失的验证 'Sys is not defined',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23541452/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com