I have snippet of js code like this
Customer.prototype.parseAddress = function(data){
this.address = data.address;
}
Customer.prototype.loadAddress = function(){
...
}
I need to implement the loadAddress function.
Can someone explain me why this snippet of code is correct
var that = this;
$.get('data.xml', function(data){
that.parseAddress(data);
});
and following is not correct
$.get('data.xml', function(data){
this.parseAddress(data);
});