title: javascript assigning variable to value return from function
body: <p>I am using the Angular JS framework.
  I have a function similar to this:</p>
  
  <pre><code>function getTypes(name) {
    var array = $http ({
      method: 'GET',
      url: "some valid url"
    )}.success(function(response) {
        return true;
    }).error(function(response) {
        //do nothing here for the sake of the example
    });
  }
  
  var isValidType = getTypes(somename);
  </code></pre>
  
  <p>The problem is that <code>isValidType</code> is always undefined, I don't get true from it. But in the success method if I assign a variable to true and log it, it works...when I debug it, it goes down the success path and should be returning true, but <code>isValidType</code> is still false.</p>