I would like to pass as parameter a generic function to be the onreadystate function, how can i do that and acess the xmlhttpobj?
Something like that:
function xmlHttp(target, xml, readyfunc) {
if (window.XMLHttpRequest) {
httpObj = new XMLHttpRequest();
} else if (window.ActiveXObject) {
httpObj = new ActiveXObject("Microsoft.XMLHTTP");
}
if (httpObj) {
httpObj.onreadystatechange = readyfunc;
httpObj.open("POST", target, true);
httpObj.send(xml);
}
}
function Run (Place){
if (xmlhttp.readyState==4 && xmlhttp.status==200)
//do a lot of things in "Place"
}
varbefore thehttpObj. Don't try to make it global.