title: Will local variables still be in scope on an Ajax call back?
body: <p>I want to call an internal function once an ajax call back function is activated.  Because there is a delay I want to know if my local variables will still be correct when it is called, particularly this.response_element as it is used by the call back function.</p>
  
  <p>The callback function is initiated when ajax <code>status == 200</code></p>
  
  <pre><code>var ControlSignIn = function( ) 
  {
      this.form_element = document.getElementById( 'signin' ),
      this.response_element = document.getElementById( 'signin_response' ),
      this.text_object = new Text( this.form_element ), 
      this.message_object = new Message( this.response_element );
  };
  
  ControlSignIn.interface = function()
  {
      new ControlSignIn().invoke();
  };
  
  ControlSignIn.prototype.invoke = function( ) 
  {
      if( CONSTANT.VALIDATE_ON === 1 )
      {
          if( !this.text_object.checkEmpty() ) 
          {
              this.message_object.display( 'empty' );
              return false;
          }
          if( !this.text_object.checkPattern( 'email' ) ) 
          {
              this.message_object.display( 'email' );
              return false;
          }
          if( !this.text_object.checkPattern( 'pass' ) ) 
          {
              this.message_object.display( 'pass' );
              return false;
          }
      }
  
  /* new internal call_back */    
  
          AjaxNew.use( ajaxSerialize( this.form_element ) + '&amp;ajax_type=ControlSignIn', ControlSignIn.invoke.callBack );
  
      function callBack( server_response_text )
      {
          ajaxType( server_response_text, this.response_element, 'respond' ); 
      }
  
  /*  Removed
      Ajax.repeatUse( ajaxSerialize( this.form_element ) + '&amp;ajax_type=ControlSignIn', ajaxTypeRespond, this.response_element );
  */
  
  };
  </code></pre>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>AjaxNew.use( ajaxSerialize( this.form_element ) + '&amp;ajax_type=ControlSignIn', ControlSignIn.invoke.callBack );
  
  var response_element = this.response_element;
  function callBack( server_response_text )
  {
      ajaxType( server_response_text, response_element, 'respond' ); 
  }
  </code></pre>