Threaded View
-
7 Nov 2011 6:49 AM #1
Answered: Ajax.request callback, no reference to controller
Answered: Ajax.request callback, no reference to controller
Hi,
I'm doing a Ajax request in my controller and have defined a callback method which should be called after the request:
ajaxResponse will be called, but after this ajax request I want to change the view and dont have a reference to this controller with 'this'. This means thatCode:Ext.Ajax.request({ url: 'http://192.168.137.1:8080/example/', method:'POST', headers: { 'Content-Type': 'application/json' }, callback: this.ajaxResponse, params: Ext.JSON.encode(form.getValues()) })
is not working, because addRef is unknown.Code:this.addRef(....)
Any ideas why I have loose the controller reference?
-
Best Answer Posted by jay@moduscreate.comCode:
Ext.Ajax.request({ url: 'http://192.168.137.1:8080/example/', method:'POST', headers: { 'Content-Type': 'application/json' }, scope : this, callback: this.ajaxResponse, params: Ext.JSON.encode(form.getValues()) })


Reply With Quote