I have this code:
MyObject = function(){
this.field = null;
this.build = function(){
var my_url = "...";
var my_data = "...";
$.get(my_url, my_data, function(result){
this.field = result;
});
}
this.get = function(){
return this.field;
}
}
object = new MyObject();
object.build();
my_result = object.get()
my_result
now is null
because when the inner function is executed this
is not my object.
So, how can i set this.field
with the $.get
returned value???