I am encountering an issue when trying to invoke the successLogin() function from within an Ajax code block using Typescript in an Ionic v3 project. The error message "this.successLogin() is not a function" keeps popping up. Can anyone provide guidance on how to work around this problem?
signin()
{
var ajaxResp = $.ajax({
type: "POST",
url: "XXX",
data: {
'uid': "50",
'pass': "100"
}
})
.done(function(response){
let js = JSON.parse(response).data;
console.log(js);
this.successLogin(js);
});
}
successLogin(msg){
console.log(msg);
}
An image of the error can be seen here.