title: Get var out of jQuery.get nested function
body: <pre><code>  function getUserHours(tyPe, tarGet){
      $.get('/activities/search', { 'type': tyPe }, 
      function(data){   
       var hourResultData = jQuery.parseJSON(data);
       var registeredHours = 0; 
       for (var i in hourResultData.activities){
        registeredHours += parseFloat(hourResultData.activities[i].hours);
       }
       $(tarGet).empty().append(registeredHours);
       return registeredHours;
     });
  
    }
  </code></pre>
  
  <p>I want:</p>
  
  <pre><code>alert( getUserHours('r', '#reg-hours'));
  </code></pre>
  
  <p>to alert registeredHours</p>