Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet Explorer没有';使用JavaScript更新标签_Javascript_Jquery_Ajax_Internet Explorer - Fatal编程技术网

Internet Explorer没有';使用JavaScript更新标签

Internet Explorer没有';使用JavaScript更新标签,javascript,jquery,ajax,internet-explorer,Javascript,Jquery,Ajax,Internet Explorer,我有一个奇怪的问题,我会尽量详细地描述 我正在用ASP.NET4.0和jQuery开发一个web模块,并使用Ajax为web服务器提供getter和setter 我有一个产品选择器,在选择产品时,我将通过Ajax调用获取数据。我在详细信息窗格中修改了产品名称、图像、描述等 它在FireFox和Chrome中运行良好,但在InternetExplorer中,产品名称(只有产品名称-图片和说明,来自同一对象工作)拒绝更新 当我在VisualStudio中放置换行符并等待几秒钟并点击F5(我看到了正确

我有一个奇怪的问题,我会尽量详细地描述

我正在用ASP.NET4.0和jQuery开发一个web模块,并使用Ajax为web服务器提供getter和setter

我有一个产品选择器,在选择产品时,我将通过Ajax调用获取数据。我在详细信息窗格中修改了产品名称、图像、描述等

它在FireFox和Chrome中运行良好,但在InternetExplorer中,产品名称(只有产品名称-图片和说明,来自同一对象工作)拒绝更新

当我在VisualStudio中放置换行符并等待几秒钟并点击F5(我看到了正确的产品名称)时,标签会更改。但当我在F5上打得很快时,它不是。因此,我放置了一个延迟为50毫秒的
setTimeout()
代码,它适用于IE

有人知道为什么在Internet Explorer中会发生这种行为吗

一些代码:

success: function (msg) {
        $("#tblHardwareOptions tr").remove();
        var tempDevice = JSON.parse(msg.d[3]);

        $("#imgDevice").attr("src", tempDevice.image);
        $("#deviceDescription").html(unescape(tempDevice.description));
        //=> setTimeOut works, added the "" to be sure it is empty
        //            setTimeout(
        //                function () {
        //without timeout it won't work in IE, even emptying the string
        //                    $(lblMachineName).text("");
        //                    $(lblMachineName).text(unescape(tempDevice.modelname));
        //                }
        //            , 50);
        //Tried without jQuery, but doesn't work neither
        document.getElementById(lblMachineName.replace("#", "")).innerText = unescape(tempDevice.modelname);

只是想知道,为什么您的选择器是这样:$(lblMachineName)?这里的LBL机器名是什么?它是一个jQuery对象吗?它是一个字符串变量。我使用单独的js文件,控件id在主页上解析。在项目开始时,我选择AutoID(默认)作为ClientIDMode,现在我坚持使用它。这并不真的困扰我,尽管mvc从长远来看会更好:-),这就是为什么我在解析控件ID时必须用#替换,因为我在前面加了#。但无论如何,我认为这不是问题所在。