PDA

View Full Version : Please Help



hsy541
5 Aug 2007, 6:05 AM
I'm a newbie to javascript. So please help me to check this

I wrote a class like this


MyClass = function(options){

this.url = options.url;

this.params = options.params;

this.logDivEL = options.logDiv;

this.autoRefresh = true;

this.keepMoniter = function(){
Ext.Ajax.request({url:this.url, params:this.params, callback: this.moniterHandler});
};

this.moniterHandler = function(ooptions,success,resp){
alert(this.logDivEL);
if(success)
this.logDivEL.innerHTML=this.logDivEL.innerHTML+resp.responseText;
};

}

When i run it in firefox it tells me that the logDivEL is undefined

hsy541
5 Aug 2007, 7:20 AM
I should read the reference more carefully :)

just change
Ext.Ajax.request({url:this.url, params:this.params, callback: this.moniterHandler});
to
Ext.Ajax.request({url:this.url, params:this.params,scope:this, callback: this.moniterHandler});