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.
JavaScript
x
26
26
1
<html>
2
<head>
3
<script type="text/javascript" charset="utf-8">
4
function loadXMLDoc() {
5
var xmlhttp;
6
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";
7
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
8
xmlhttp=new XMLHttpRequest();
9
} else {// code for IE6, IE5
10
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
11
}
12
xmlhttp.onreadystatechange=function() {
13
if (xmlhttp.readyState==4) {
14
window.alert(xmlhttp.responseText);
15
}
16
}
17
xmlhttp.open("GET", urlString, true);
18
xmlhttp.send();
19
}
20
</script>
21
</head>
22
<body>
23
<span onclick="loadXMLDoc()">Click Me</span>
24
</body>
25
</html>
26
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.