I want to make a YAHOO.util.Connect.asyncRequest call, which not is async. Just like open(method, url, async) where false is passed by async.
I can't find a "syncRequest" in the Connect class. Is this possible using YUI 2?
I tried without YUI instead:
function createRequestObject() {
var ro;
// Mozilla, Safari,...
if (window.XMLHttpRequest) {
ro = new XMLHttpRequest();
if (ro.overrideMimeType) {
ro.overrideMimeType('text/xml');
// See note below about this line
}
// IE
} else if (window.ActiveXObject) {
try {
ro = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ro = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!ro) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
return ro;
}
function sndReq(param,server,handler) {
http = createRequestObject();
http.open('GET', server+"?"+param, false);
http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http.onreadystatechange = handler;
http.send(null);
}
But in FireFox and Safari the callback function (handler) is not called on 'onreadystatechange' when false is passed in 'open'? In IE and Opera it works ok.