0

I have the following code:

var tradingInterface = function() {

    this.json = '';

    this.init = function() {

        $.get( '/whatever',{}, function(data) {
            this.json = data;
            // Rebuilds Everything
            this.rebuildAll();
        });
    };

    this.rebuildAll = function() {
        //whatever here
    };

};

Why am I getting in init function the following error?

ReferenceError: this.rebuildAll is not defined
this.rebuildAll();

Why can I access to this.json without scoping problems but not to this.rebuildAll?

Regards,

Egidi
  • 1,736
  • 8
  • 43
  • 69

0 Answers0