title: Accessing Grandparent's variable
body: <p>I have an Object with the variable "parentVar", and I want to write the response of an ajax-request into it.
  Sounds easy, but I'm not able to do this, due to some namespace-troubles.</p>
  
  <p>I wrote a very minimalistic example, which shows the problem.</p>
  
  <p>The ajax-request will be started, when I call the Object's init-Function:</p>
  
  <pre><code>var parentObj = new Parent();
  //Do some work (I need some functionality from the object before it can be fully initialized)
  alert("Old Value = " + parentObj.parentVar);
  parentObj.init(function(){
      alert("New Value = " + parentObj.parentVar);
  });
  </code></pre>
  
  <p>The init-Function calls the Function "load" which performs an Ajax-Request, and returns the received data (in another callback-Function).</p>
  
  <pre><code>function Parent(){
      this.parentVar = "old";                 //this value should be replaced
  
      this.init = function(initCallBack){
  
          this.load(function(newData){        //load the content of the file
              this.parentVar = newData;       //write the content into the variable
              initCallBack();                 //I'm done!
          });
  
      }
  
      this.load = function(callbackFunc){
          //load the new value from a file via ajax (asyncron).
          //When finished: call callbackFunc
          callbackFunc("newValue");
      }
  }
  </code></pre>
  
  <p>I already tried passing the scope to the loader-function, and getting it back in the callBack-Function. But it didn't work.</p>
  
  <p>I also tried "<code>var parentscope = this;</code>" in the init-Function, 
  and "<code>parentscope.parentVar = newData;</code>" - it didn't work either.</p>
  
  <p>Is it possible to achieve this with parentVar being private? (I mean "<code>var parentVar = 'old';</code>" instead of "<code>this.parentVar = 'old';</code>").</p>