Skip to content
Advertisement

AJAX Problem – No response text in FireFox, but ok in IE

I am making a simple AJAX call to an external site. It works ok in IE, but in Firefox, not response text is returned.

I think it might have something to do with the response being “chunked”, but I’m not sure.

Any ideas? Thanks.

<html>
<head>
    <script type="text/javascript" charset="utf-8">
        function loadXMLDoc() {
            var xmlhttp;
            var urlString = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=6025&Destination_Postcode=6055&Country=AU&Weight=100&Service_Type=STANDARD&Length=100&Width=100&Height=100&Quantity=2";
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            } else {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4) {
                    window.alert(xmlhttp.responseText);
                }
            }
            xmlhttp.open("GET", urlString, true);
            xmlhttp.send();
        }
    </script>
</head>
<body>
    <span onclick="loadXMLDoc()">Click Me</span>
</body>
</html>

Advertisement

Answer

Is your page hosted at http://drc.edeliver.com.au also? If not, then you can’t make an XMLHttpRequest to that URL. It’s a violation of basic browser security which, for your IE tests, are probably suppressed by explicit browser configuration.

edit — I think IE lets the “local security zone” (or whatever they call it) get away with stuff that is not allowed for “Internet” zone pages.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement