sjd_buffa
08-02-2010, 10:29 AM
Hello,
This is the gist of the code:
[CODE]
function AjaxClass (url,callback) {
this.url = url;
this.callback = callback;
this.do = function () {
ajax = new ...;
ajax.onreadystatechange = function () {
if (ajax.readyState==4 && ajax.status==200)
this.callback(ajax); /* undefined */
};
ajax.open(this.url);
ajax.send();
};
}
function doSomething (ajaxObj) {
}
myAjax = new AjaxClass(doSomething);
[CODE]
[ICODE]this.callback(ajax)[ICODE] is undefined inside the onreadystatechange handler.
What am I doing wrong? Any help would be appreciated.
Thanks,
sjd_buffa
This is the gist of the code:
[CODE]
function AjaxClass (url,callback) {
this.url = url;
this.callback = callback;
this.do = function () {
ajax = new ...;
ajax.onreadystatechange = function () {
if (ajax.readyState==4 && ajax.status==200)
this.callback(ajax); /* undefined */
};
ajax.open(this.url);
ajax.send();
};
}
function doSomething (ajaxObj) {
}
myAjax = new AjaxClass(doSomething);
[CODE]
[ICODE]this.callback(ajax)[ICODE] is undefined inside the onreadystatechange handler.
What am I doing wrong? Any help would be appreciated.
Thanks,
sjd_buffa