I'm trying to GET or POST a request to a server. The code below works fine in Firefox, Safari, Chrome and IE7+ but fails in IE6 in spite of the xmlHttpCreate function being copied and pasted straight from Microsoft's MSDN site. The place where IE6 fails is on the oReq.send() line. It appears to create an activeX object but just won't send it. I have also tried oReq.send(null) and oReq.send("") but neither works.
function _call(url){
oReq = xmlHttpCreate();
if (oReq != null) {
//oReq.open("GET", url, false);
oReq.open("POST", url, false);
oReq.send(); // <=============== this is where IE6 fails
return oReq.responseText;
}
else {
alert("AJAX (XMLHTTP) not supported.");
}
}
function xmlHttpCreate(){
if (window.XMLHttpRequest) {
return new window.XMLHttpRequest;
}
else {
try {
return new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch(ex) {
return null;
}
}
OK, so first and foremost - MASSIVELY greatful to you for your replies :-)
Now in responce to all of the above -
I've tried
return new ActiveXObject("Msxml2.XMLHTTP");
but decided to go with the Microsoft recommendation of
return new ActiveXObject("MSXML2.XMLHTTP.3.0");
(see http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx )
neither makes any difference
in reply to "You are getting http status code of 122"
I've tried both POST and GET. Both work in IE7+ and Firefox but neither work in IE6
in reply to "You can do a JSONP call using the jsoncallback"
I'm not using jQuery.
Our ajax call is made to a php script on our server. The php script makes the call to Flickr and returns the result to the javascript.
Since we are using Mootools to do the slideshow I'll investigate whether it has a similar function to JSONcallback in jQuery
Bookmarks