I have folowing AJAX connector:
Code:
function ajaxConnect(url, postData, callBackFunction, mode) {
var xmlObj = new Object();
if (window.XMLHttpRequest) {
xmlObj = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert("Error initializing XMLHttpRequest");
return;
}
xmlObj.onreadystatechange = function(){
if(xmlObj.readyState == 4){
if (xmlObj.status == 200) {
var elArr = xmlObj.responseXML.getElementsByTagName('root')[0].childNodes;
if (callBackFunction != "") {
callBackFunction(elArr);
} else {
return true;
}
} else {
alert("There was a problem retrieving the XML data");
return false;
}
}
}
xmlObj.open("POST",url,mode);
xmlObj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
if (xmlObj.overrideMimeType) {
xmlObj.setRequestHeader("Connection","close");
}
xmlObj.send(postData);
}
It called from:
Code:
var postData = "wordlist="+encodeURIComponent(strWordList);
var url = "/admin/spell/spell_checking.php?Lang="+Lang;
var callBackFunction = spellResultHandle;
ajaxConnect(url, postData, callBackFunction,false);
Where spellResultHandle - some function which handle result of the request and return it. I need to use synchronous mode because of result of spellResultHandle used below in code.
SO THE PROBLEM IS:
This code works in IE, Opera, but doesn't work in FF(1.5.0.6).
If I change mode to asynchronous - works, but it doesn't approach to programm logic.
Any suggestions would be welcome.
TIA