1

In the following code snippet I wish to access the function parameter url1 in the success callback. Is is possible to set the scope of Ext.Ajax.request to the function scope rather than the class scope?

Ext.define('Venus.controller.LightNode', {
extend: 'Ext.app.Controller',
config: {...},

updateUIElement: function(url1) {
var me = this;
Ext.Ajax.request({
        url: url1,
        method: 'GET',
        timeout: 2000,
        scope: me, 
        useDefaultXhrHeader: false,

        success: function(response) {
            //How can I access url1 here?
        }
});
},
});
mr_js
  • 949
  • 12
  • 29
  • You just use `url1` in success, it's in the scope. You don't need anything special to read this variable. – dfsq Oct 30 '14 at 13:19
  • Unfortunately this doesn't work. Trying to access url1 in the success callback results in: ReferenceError: url1 is not defined. This is the case with and without the line scope: me – mr_js Oct 30 '14 at 13:27
  • Ok, it means that you didn't post actual code, you probably stripped out some parts of it. Can you add complete example of you code? Because `url1` is in the same scope according to your current code. – dfsq Oct 30 '14 at 13:32
  • Have updated to show the function within the context of the entire controller class. – mr_js Oct 30 '14 at 13:45

1 Answers1

3

I believe dfsq is right, but if you can't this might be because of the scope of the Ext.Ajax

This should help anyways:

response.request.options.url
Dinkheller
  • 4,631
  • 5
  • 39
  • 67