JavaScript this scope in callback functions -


how can access object properties functions called callback function. please see code below. how can access config property processdata function called when data received server in ajax call.

myclass: {     config: {         name: "",         id: ""     },      loaddata: function() {         myapi.getdata(             this.config,             this.processdata,   //sucess             this.failurehandler //failure         );     },      processdata: function() {         // how access config object here?      } } 

probably can create anonymous handler function , use call or apply pass scope actual handler function there better solution that?


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -