C# 代码在Chrome中工作,但在IE11中不工作

C# 代码在Chrome中工作,但在IE11中不工作,c#,jquery,asp.net-mvc,C#,Jquery,Asp.net Mvc,我在MVC5中有以下代码,无法理解为什么在IE中运行时会出错。在chrome中运行良好。我读过一篇关于jquery、bootstrap等的顺序的文章,并尝试了这些修复,但都没有帮助。有人知道这为什么行不通吗 捆绑图 using System.Web; using System.Web.Optimization; namespace PaceArt_Document_Viewer { public class BundleConfig { // For more

我在MVC5中有以下代码,无法理解为什么在IE中运行时会出错。在chrome中运行良好。我读过一篇关于jquery、bootstrap等的顺序的文章,并尝试了这些修复,但都没有帮助。有人知道这为什么行不通吗

捆绑图

using System.Web;
using System.Web.Optimization;

namespace PaceArt_Document_Viewer
{
    public class BundleConfig
    {
        // For more information on bundling, visit     https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

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

            // Use the development version of Modernizr to develop with and     learn from. Then, when you're
            // ready for production, use the build tool at     https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }
    }
}
更新 我尝试了所有的修复方法,但似乎没有任何效果。调试器说这是“$(document.ready…”之前的第一个$。我将脚本src标记内联在一起,调用jquery、validate和modinizr,但仍然得到相同的错误

<script>
    $(document).ready(function () {
        @{
            var folderPath = Request.Url.Segments.Last();
            string url = HttpContext.Current.Request.Url.AbsoluteUri;
            string urlSegment = url.Substring(folderPath.LastIndexOf('/') + 1);
            string urlFilePath = url.Remove(urlSegment.Length - 4);
        }
        var filePath = "@folderPath";//02939e1a435e46169076a0f9c5960647 //3740da10833b4de481a3e558a7a69889"; 
        var url = "@Url.Action("GetPDFInline", new { filePath = -1 })";
        var result = url.replace(-1, $("#pdfDisplayPathInline1").val());
        $("#pdfDisplay").attr('src', result)

        $('.pdfLinks').on('click', function () {
            var value = $(this).text();
            var valueUpdate = value.slice(0, -4);
            var path;
            var filePathTrim = filePath.slice(0, -4);
            if (filePathTrim == valueUpdate) {
                path = filePathTrim + ".pdf";
            } else {
                path = filePathTrim + "\\" + valueUpdate + ".pdf";
            }
            var url = "@Url.Action("GetPDFAttachments", new { filePathlink = -1 })";
            var result = url.replace(-1, path);
            $("#pdfDisplay").attr('src', result)
        });
    });
</script>

$(文档).ready(函数(){
@{
var folderPath=Request.Url.Segments.Last();
字符串url=HttpContext.Current.Request.url.AbsoluteUri;
字符串URLSEMENT=url.Substring(folderPath.LastIndexOf('/')+1);
字符串urlFilePath=url.Remove(urlsection.Length-4);
}
var filePath=“@folderPath”//02939e1a435e46169076a0f9c590647//3740da10833b4de481a3e558a7a69889”;
var url=“@url.Action”(“GetPDFInline”,新的{filePath=-1})”;
var result=url.replace(-1,$(“#pdfDisplayPathInline1”).val();
$(“#pdfDisplay”).attr('src',result)
$('.pdfLinks')。在('click',函数(){
var值=$(this.text();
var valueUpdate=value.slice(0,-4);
var路径;
var filepathctrim=filePath.slice(0,-4);
如果(filePathTrim==valueUpdate){
path=filePathTrim+“.pdf”;
}否则{
path=filePathTrim+“\\”+valueUpdate+“.pdf”;
}
var url=“@url.Action(“GetPDFAttachments”,new{filePathlink=-1})”;
var result=url.replace(-1,路径);
$(“#pdfDisplay”).attr('src',result)
});
});

由于捆绑包中的这一行,IE可能难以找到正确版本的jQuery-

"~/Scripts/jquery-{version}.js"
不要使用jQuery捆绑包,而是尝试将脚本标记与适当版本的jQuery(完整版本而不是min)一起使用



如果可以的话,那么修改你的包,使之适合…

什么特别不起作用?你有什么错误吗?如果与js相关,可能会丢失;(冒号)在这条语句中$(“#pdfDisplay”).attr('srcdoc',result)和$(“#pdfDisplay”).attr('srcdoc',result)对不起,控制台显示:“无法获取未定义或空引用的属性'fn”“我刚刚注意到它还说jquery缺少一个预期的标识符,“属性“$”的值为null或未定义,而不是函数对象”,然后我建议在ie中按ctrl F5清除缓存
<script src="js/jquery-3.3.1.min.js"></script>