asked on
sendBaseRequest( 'index.php', document.getElementById('myDiv'));
function sendBaseRequest(address, output) {
http.open('get', address);
a = new baseHandler();
a.setTarget( output );
output.style.display = 'block'
http.onreadystatechange = a.handler;
http.send(null);
}
baseHandler = function(){
this.objElement;
baseHandler.prototype.setTarget = function( objElement ){
// I'm sure it should be this way round, but the browser knows what it likes...
// this.objElement = objElement;
this.handler.objElement = objElement;
}
baseHandler.prototype.handler = function(){
if(http.readyState == 4){
var response = http.responseText;
this.objElement.innerHTML = response;
}
}
}