title: Unable to return value from javascript funtion
body: <p>I have a generic function for retrieving data from an outside source as a GET request. I am able to console.log() the response Text inside the function just fine so I know it's retrieving the intended data but every attempt I have made to return said data to a variable has failed dismally. I'm completely at a loss at this point as to how to proceed. Any pointers would be greatly appreciated. </p>
  
  <p>Also it's worth mentioning, due to platform constraints I'm looking to do this purely in javascript.</p>
  
  <pre><code>function httpGet(file){
    var xmlhttp;
    if(window.XMLHttpRequest){
      xmlhttp = new XMLHttpRequest();
    }else {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200){
          console.log(xmlhttp.responseText);
          return xmlhttp.responseText;
        }
      };
      xmlhttp.open("GET", file, true);
      xmlhttp.send();
  }
  
  var test = String("file.txt");
  result = httpGet(test);
  console.log(result);
  </code></pre>