title: Passing local variables from a function out to become global variables
body: <p>I've spent the last two hours trying to figure out how to do this but nothing is working. Here is a short sample of some of my code. I want to get arrtime and several other similar variables out of the function so I can use them globally. Any ideas? Nothing too complicated please, I'm no expert (obviously).    </p>
  
  <pre><code>function showTest(str) {
  ........
  
          var arrayvals = JSON.parse(xmlhttp.responseText);
          var arrtime= (arrayvals[0]);
  }
  var testvar=arrtime;
  document.getElementById("testing").innerHTML=testvar;   
  </code></pre>