In IE, I can only send request to server 7 times maximum when using ajax

妖精的绣舞 提交于 2020-01-06 05:10:47

问题


I added ajax to a web application with 7 'select' tags, in which selecting an option would populate the following 'select' tags with the related information. And some of these tags can also show another set of radio buttons or checkboxes. In all, you can make more than 10 requests to the server until you get your desired product. All work fine in major browsers except in IE, where the request to the server are limited to 7 times and then nothing happens any more until you refresh the browser to start again. I even tried to disable the cache, but still the same problem occured...

Why is IE doing this nonsense?

This is the ajax code doing the server-client talking:

function updateAvailableAttributes()
{
var xmlhttp;
var form = document.forms["orderDefinition"];
form.elements["formChangeRequest"].value = "true";
var processingMsgBox = $("#waitingMsgOverlay, #waitingMsgBox, #waitingMsg, #waitingMsgParag");
var map = document.getElementById("OrderMap");

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

xmlhttp.onreadystatechange = function()
{
    switch(xmlhttp.readyState)
    {
        case 1:
            map.disableApplication();
            processingMsgBox.show();
            break;
        case 4:
            if(xmlhttp.status == 200)
            {
                $('#usercontent .sleeve .toprow').html(xmlhttp.responseText);
                applyValidation();
                browserScrollManagement();
                $("#toolpanel").height($("#orderMap").height());
                inputBtnHighlightSelection();
            }
            else
            {
                sessionTimedOut();
            }

            $("#toolpanel").height($("#orderMap").height());
            map.enableApplication();
            processingMsgBox.hide();
            break;          
    }
}

var parameters = $("form#orderDefinition").serialize();
xmlhttp.open("POST", "ajax/possibleValues.html", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", parameters.length);
xmlhttp.setRequestHeader("Cache-Control", "no-cache");
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(parameters);
}

回答1:


The HTTP spec recommends that simultaneous connections to a web server must be limited. The limit is lower for IE7 than it is for other browsers. Modify the registry to increase it for testing purposes only.



来源:https://stackoverflow.com/questions/3830015/in-ie-i-can-only-send-request-to-server-7-times-maximum-when-using-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!