I can't get my nested function to recognize the "this" keyword. Here is an example. I have a constructor function:
function person(first, last, age, eyecolor) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.changeName = changename;
}
I have another function with a nested function:
function changeName (name) {
this.lastname = name;
$.post("display.php", "some_data", function(data,status) {
if (status=="success") {
alert(this.lastName); //undefined
}
}
}
Person, notperson).