Good morning SO, I am moving from the functional programming methodology of JavaScript to the Object Oriented methodology and have a question. In functional programming I could just call a function within another function example:
function a(){
// do something and when done call function b
b();
}
function b(){
// does more stuff
}
Now that I am switching to the OOP approach how would I call a method in an object from another method in the same object. for example:
var myClass = function(){
this.getData = function(){
//do a jquery load and on success call the next method
$('#a').load('file.asp',function(response,status,xhr){
switch(status){
case "success":
//THIS IS WHERE THE QUESTION LIES
this.otherfuntcion();
break;
}
}
}
this.otherfunction = new function(){
// does more stuff
}
}
p = new myClass();
p.getData();
Can I say this.b() on success to call the method b or do i have to do something else? Thank you in advance.