简体   繁体   English

Internet Explorer错误消息“操作已超时”

[英]Internet Explorer error message “The operation was timed out”

I have a piece of code that works in chrome and firefox but not in internet explorer. 我有一段代码可以在chrome和firefox中使用,但不能在Internet Explorer中使用。 I can't figure out what that actual cause is. 我不知道是什么原因造成的。 I get a operation timeout message from internet explorer "Message: The operation was timed out." 我从Internet Explorer收到操作超时消息"Message: The operation was timed out."

This is the ajax function I am using, it's from w3schools so I know this is correct. 这是我正在使用的ajax函数,它来自w3schools,所以我知道这是正确的。

function ajax() {    
    var xmlhttp;
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    alert(xmlhttp);
    return xmlhttp;
}

This is the code that's getting stuck on. 这是被卡住的代码。 The error message is in "ajaxRequest.send(postdata);" 错误消息在"ajaxRequest.send(postdata);" .

function edit(){
    var ajaxRequest = ajax();   
    var postdata = "data=" + document.getElementById("id1").value + "<|>" + document.getElementById("id2").value + "<|>" +  document.getElementById("id3").value;


    ajaxRequest.onreadystatechange = function(){
            var ajaxDisplay = document.getElementById('ajaxDiv');
        if(ajaxRequest.readyState == 4 && ajaxRequest.status==200){
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
        }
    }   
    alert(postdata);
    ajaxRequest.open("POST","confirmPage.php",false);
    ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    ajaxRequest.send(postdata);
    alert("Finished");
}

All the other pages work with the same code in internet explorer but not this particular page. 所有其他页面在Internet Explorer中都使用相同的代码,但不适用于此特定页面。 I can't seem to figure to out why. 我似乎无法弄清楚为什么。 This page works in chrome and firefox but not in internet explorer. 此页面适用于chrome和Firefox,但不适用于Internet Explorer。 It never goes to "Finished". 它永远不会转到“完成”。 I am using IE 8. 我正在使用IE 8。

As you require synchronous behaviour try the following: 当您需要同步行为时,请尝试以下操作:

ajaxRequest.open("POST", "confirmPage.php", false);
ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxRequest.send(postdata);

if (ajaxRequest.status === 200) {
    document.getElementById('ajaxDiv').innerHTML = ajaxRequest.responseText;
}

alert("Finished");

You don't need the onreadystatechange as the request is synchronous. 您不需要onreadystatechange因为请求是同步的。

Partial answer: 部分答案:

I figured out the problem. 我解决了这个问题。 It's not javascript and/or ajax. 不是javascript和/或ajax。 IE can't handle a large number of results in queries so it times out. IE无法处理查询中的大量结果,因此超时。 It's a very obscure error as I was thinking it's something to do with the ajax functions rather than the php file. 这是一个非常晦涩的错误,因为我一直认为这与ajax函数而不是php文件有关。

The result set is not huge. 结果集不是很大。 There are 5 different queries. 有5个不同的查询。 Each one with about 5-50K records(I am not printing all of them, just querying). 每个记录大约有5-50K(我不打印所有记录,只是查询)。 It times out after a large result set. 在设置大量结果后超时。

To test I created a test page with simple SELECT * queries and it can handle only 2-3 queries. 为了进行测试,我使用简单的SELECT *查询创建了一个测试页,它只能处理2-3个查询。 If it's more than that it times out. 如果不止于此,它将超时。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Internet Explorer中加载网页时出现“操作中止”错误消息 - “Operation aborted” error message when loading a webpage in Internet Explorer Internet Explorer中的“操作已中止”错误是什么? - What is the “Operation Aborted” error in Internet Explorer? 来自 MongoDB 的错误消息“操作 `disneys.insertOne()` 缓冲在 10000 毫秒后超时”” - Error Message from MongoDB "Operation `disneys.insertOne()` buffering timed out after 10000ms"" PhantomJS 408错误“套接字操作超时” - PhantomJS 408 error “Socket operation timed out” 是否有任何好的或可靠的方法来确定JavaScript错误仅使用Internet Explorer错误消息? - Is there any good or reliable way to figure out where a JavaScript error is using only an Internet Explorer error message? FirebaseError:数据存储操作超时 - FirebaseError: The datastore operation timed out Internet Explorer脚本错误,网页消息,权限被拒绝 - Internet Explorer Script Error, Message from Webpage, Permission denied Internet Explorer 8中有一个Javascript / Ajax错误消息! 顺便说一下,这不是令人震惊的部分 - there's a Javascript/Ajax error message in Internet Explorer 8! by the way this is not the shocking part 调试错误消息:“此页面上的脚本导致 Internet Explorer 运行缓慢” - Debugging error message: “A script on this page is causing Internet Explorer to run slowly” Internet Explorer无法打开Internet站点操作已中止,如何解决此错误? - Internet Explorer Cannot Open the Internet Site Operation Aborted, how to fix this error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM