简体   繁体   中英

Jquery validation not working on staging and production systems

I am using jquery.validate.js in my MVC Cshtml project and for some reason the validations seem to work fine on my dev machine but fail to work on production machine

This is my jquery bundle

    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                "~/Scripts/jquery.unobtrusive-ajax.js",
                "~/Scripts/jquery.validate-vsdoc.js",
                "~/Scripts/jquery.validate.js",
                "~/Scripts/jquery.validate.unobtrusive.js"
                ));

This is my cshtml

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/ChosenJq")
     <script type="text/javascript">
.....

All jquery scripts are in the right order ie Jquery included first and then . The code base on both the dev machine and the stag and prod machines are the same. The code works fine on the dev machine as seen below.(For email id) 在此处输入图片说明

But the validation just does not happen on either staging or production machines as seen below

在此处输入图片说明

On the console I see this error on all machines.

在此处输入图片说明

But it doesnt seem to affect me on the dev machine but only on the prod ones. Has anyone faced this before. I searched on SO but I couldnt relate to them

Staging and Production Environments: IIS, Windows Server 2008 R2

Actually during Staging the bundle did only ship the min files and hence include the min file versions in your bundle as follow.

 "~/Scripts/jquery.validate.min.js",

Or

Set the EnableOptimization property as false to ship the non-min files during staging.

BundleTable.EnableOptimizations = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM