title: Ext JS 4.1.3: Returning values with Ext.Ajax.request
body: <p>This might be a silly question, but I have been struggling with the following piece of code in my Ext JS 4.1.3 application:</p>
  
  <pre><code>getInvestmentFee_Percentage : function() {
      var rVal = 0;
  
      Ext.Ajax.request({ 
          url : 'index.php/ajax/getcountryinvestmentfeepercentage/', 
          success : function(transport, json) {
               try {
                    var JSONResponse = Ext.JSON.decode(transport.responseText);
               } catch (e) {
                    return false;
               }
  
               if(JSONResponse.success == true || JSONResponse.success == "true") {
                    var investTax = 1+parseFloat(JSONResponse.results[0].constantValue);
                    console.log(investTax);
                    // TODO Return investTax
                    return investTax;
               } else {
                    return false;
               }
          },
          failure : function(transport, json) {
              return false;
          }
     });
  
      return rVal;
  }
  </code></pre>
  
  <p>I'm trying to write to the <code>rVal</code> variable, but since the <code>Ext.Ajax.request</code> is a different object, it will not do so. How do I return the value for use outside the AJAX request? I could of course write to global variables, but I doubt it's the right way to do this. </p>
  
  <p>Any suggestions appreciated.</p>