J
Jacob Friis Larsen
Anyone know how to let processReqChange know that it is in an object?
In Php I can do it like this: array($this, 'function_name');
Any idea for a workaround?
/Jacob
function ajax () {
this.url = '';
this.getXML = getXML;
this.processReqChange = processReqChange;
function getXML () {
if (window.XMLHttpRequest) {
this.req = new XMLHttpRequest();
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send(null);
} else if (window.ActiveXObject) {
this.req = new ActiveXObject('Microsoft.XMLHTTP');
if (this.req) {
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send();
}
}
}
function processReqChange () {
if (this.req.readyState == 4) {
if (this.req.status == 200) {
alert('ok');
} else {
alert('There was a problem retrieving the XML data:' +
this.req.statusText);
}
}
}
}
In Php I can do it like this: array($this, 'function_name');
Any idea for a workaround?
/Jacob
function ajax () {
this.url = '';
this.getXML = getXML;
this.processReqChange = processReqChange;
function getXML () {
if (window.XMLHttpRequest) {
this.req = new XMLHttpRequest();
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send(null);
} else if (window.ActiveXObject) {
this.req = new ActiveXObject('Microsoft.XMLHTTP');
if (this.req) {
this.req.onreadystatechange = this.processReqChange;
this.req.open('GET', this.url, true);
this.req.send();
}
}
}
function processReqChange () {
if (this.req.readyState == 4) {
if (this.req.status == 200) {
alert('ok');
} else {
alert('There was a problem retrieving the XML data:' +
this.req.statusText);
}
}
}
}