title: Using Javascript / JQuery to access an array built from an external XML file
body: <p>I hope this is not too much of a newbe question but I've been pulling my hair out for a while now so thought I'd give in and ask for my first piece of advice on here.</p>
  
  <p>I'm trying to read an external xml file using javascript / jQuery / ajax and place the retrieved data into an array so that I can then reference it later.</p>
  
  <p>So far I seem to be doing everything right upto the point I put the data into the array but then  I'm struggling to to read the data anywhere other than inside the function where I create it. Why am I not able to access the Array from anywhere other than in that function?</p>
  
  <p>Here is my code...
  Please help!!</p>
  
  <pre><code>$.ajax({
      type: "GET",
      url: "data.xml",
      dataType: "xml",
      success: do_xmlParser
  });
  
  function do_xmlParser(xml)
  {
      var myArray = new Array();
  
      $(xml).find("tag").each(function ()
      {
          myArray.push($(this).find("innerTag").text());
      });
  
      console.log("inside "+myArray); // This outputs the array I am expecting
  
      return myArray; // is this right???
  }
  console.log("outside: "+myArray); // This does NOT output the array but instead I get "myArray is not defined"
  </code></pre>