Hi,
So I'm building a class which runs function asynchronously. I want to set the class variables when the callback function returns the values. Unfortunetly I'm having some trouble doing so.
This is my class:
What i want is access to the classe's "title" variable so that the variables are set when the load method finishes executing. Unfortunetly, using this.title on the callback function defines the variable to the callback function instead of the class.Code:function Users(){ this.title = 'not defined'; this.url='user/'; }; Users.prototype.load=function( scallbackf, ecallbackf,baseUrl) { var v_usersload = new data_load(this.url,function(rObject){ this.title=rObject.title; scallbackf(); }, function(errObj,err){ if (ecallbackf==undefined){ alert(err); }else{ ecallbackf(errObj,err); } }, baseUrl); };
Any ideas?
Regards


Reply With Quote
Bookmarks