title: Javascript methods recalling and printing
body: <p>I'm studying JavaScript and I've some problems with the recall of functions...</p>
  
  <p>These are my two functions:
  the first:</p>
  
  <pre><code>function geisson() {
      var iabile = new XMLHttpRequest();
      iabile.onreadystatechange = function () {
          if (iabile.readyState == 4) {
              var objectjson = {};
              var arrayCards = []; //creazione dell'array che conterrà le cards
              objectson = JSON.parse(iabile.responseText);
              arrayCards = objectson.cards;
              var Ettore = []; //Vèttore di cards
  
              //the results
              for (i = 0; i &lt; arrayCards.length; i++)
                  document.getElementById('image').src = "http://www.mysite.com/png/public/card/" + arrayCards[i].__guid__ + "?width=292";
          }
      }
      iabile.open("GET", "gnekcard.json", true);
      iabile.send(null);
  }
  </code></pre>
  
  <p>and the second function:</p>
  
  <pre><code>function Entity() {
      var iabile = new XMLHttpRequest();
      iabile.onreadystatechange = function () {
          if (iabile.readyState == 4) {
              var objectjson = {};
              var arrayCards = []; //creazione dell'array che conterrà le cards
              objectson = JSON.parse(iabile.responseText);
              arrayCards = objectson.cards;
              //the results
              for (i = 0; i &lt; arrayCards.length; i++)
                  document.getElementById('informazioni').innerHTML += "\r\n" + "Nome : " + arrayCards[i].__title__ + "\r\n" + "Vanity url: " + arrayCards[i].vanity_urls[0] + "\r\n";
          }
      }
      iabile.open("GET", "gnek.json", true);
      iabile.send(null);
  }
  </code></pre>
  
  <p>I would like to have a third function that prints the results of the other 2 functions. I'd  prefer to have the "for" in only in the third function and recall the vectors of the others methods but they aren't global. I don't want to have global variables (if possible) so how can I do it?</p>