I have written some object oriented Javascript like this:
function MyClass(){
this.SomeFunc(arg1){
result = <some processing on arg1>;
return result;
};
this.SomeOtherFunc(){
return $.ajax({
<some restful call>
}).done(function(){
var localvar = this.SomeFunc(<value obtained by restful call>);
<some operations with localvar>;
});
};
};
var myObj = new MyClass();
myObj.SomeOtherFunc();
And I get an error in the web console: "this.SomeFunc is not a function". If I call it within a function directly, there is no problem. The call fails only inside Ajax. What would be the proper way of making this function call?