Reputation: 25
I have a Controller with these functions:
onBtnBack: function(){
Ext.Viewport.setActiveItem('vLogin');
},
onBtnSave: function (){
Ext.Ajax.request({
success: function(response) {
Ext.Msg.alert('', 'OK', Ext.emptyFn);
onBtnBack();
}
});
},
I'm trying to execute onBtnBack(); function inside success, but I'm getting this error:
Uncaught ReferenceError: onBtnBack is not defined.
tried to put this.onBtnBack();
but it doesn't work either.
Does anyone know what cause this error?
Thanks!
Upvotes: 1
Views: 1171
Reputation: 711
Another way:
onBtnSave: function() {
Ext.Ajax.request({
success: function(response) {
Ext.Msg.alert('', 'OK', Ext.emptyFn);
this.onBtnBack();
},
scope: this
});
}
Upvotes: 0
Reputation: 5700
Try this:
onBtnSave: function (){
var me = this;
Ext.Ajax.request({
success: function(response) {
Ext.Msg.alert('', 'OK', Ext.emptyFn);
me.onBtnBack();
}
});
Upvotes: 1