title: CSV file to Varible struggling, using papa.parse
body: <p>Ok, the goal is to copy the CSV from a file and store them as a string in javascript.</p>
  
  <p>Using Papaparse I have managed to get the contents from the CSV file but I cant seem to save the string outside of papaparse to use in another script.</p>
  
  <p>I have very new to javascript so be kind :)</p>
  
  <p>the while loop is to adjust the format to how i need it, however if i can get the data out i can do this outside of where it currently sits. Any help is welcome as this is driving me nuts! many thanks!! :D</p>
  
  <pre><code>&lt;title&gt;Test stuff&lt;/title&gt;
  &lt;script src="./Plugins/papaparse.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;script&gt;
  Papa.parse("http://test_server/OpenSiteVisitTickets.csv", {
  download: true,
  complete: function(results) {
  console.log("Remote file parsed!", results);
      var i= 0, x= [1],cname= [1],postc= [5],alenth = results.data.length -2;
          locations= [];
          while ( i &lt; alenth )
              {
              var ltemp =[];
  
              ltemp = "[" + results.data[x] [cname] +", "+results.data[x] [postc] +"] ";
                  locations = locations.concat(ltemp);
              i++,x++;
              }
      document.getElementById("demo").innerHTML = locations;
       }
      });
   &lt;/script&gt;
   &lt;script&gt;
    // other script goes here and picks up locations var todo its funky shiz :)
   &lt;/script&gt;
  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>