title: Parse a text file into an array?
body: <p>I currently have 3 files; they are in the same directory on my computer:</p>
  
  <ul>
  <li>project.html</li>
  <li>javascript.js</li>
  <li>text.txt</li>
  </ul>
  
  <p><strong>Code in 'project.html'</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
      &lt;script type="text/javascript" src="javascript.js"&gt;
      &lt;/script&gt;
      &lt;script
          //calling the Google Maps API
      &lt;/script&gt;
  
      &lt;script&gt;
          //code to initialize Google Maps
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="content"&gt;
          &lt;div id="googleMap"&gt;&lt;/div&gt;
          &lt;div id="right_pane_results"&gt;hi&lt;/div&gt;
          &lt;div id="bottom_pane_options"&gt;
              &lt;button onclick="get_parameters()"&gt;Try It&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Code in 'javascript.js'</strong></p>
  
  <pre><code>function get_parameters() {
      alert('hi');
      var xhr = new XMLHttpRequest();
  
      xhr.addEventListener('readystatechange', (output) =&gt; {
        if (xhr.readyState === 4) {
          var response = xhr.responseText;
          callback(response);
        }
      });
  
      xhr.open('GET', 'text.txt', true);
      xhr.send();
  }
  </code></pre>
  
  <p><strong>Text in 'text.txt'</strong></p>
  
  <ul>
  <li>Iron</li>
  <li>Aluminum</li>
  <li>Steel</li>
  </ul>
  
  <p>etc... (close to 150 lines)</p>
  
  <p>At the end of everything, I would like to parse 'text.txt' into an array and use that array to create an option menu with the array's content.  I have posted a question asking whether I can parse the file using JavaScript and the answer was no due to security issues.  The JavaScript code is what I have tried but has not worked.  That said, is there another language I can use to read the file and create the option menu?</p>
  
  <p>I would eventually like to have something like this (below) in the 'project.html' file:</p>
  
  <pre><code>&lt;select&gt;
      &lt;option value="1"&gt;Line 1 of File&lt;/option&gt;
      &lt;option value="2"&gt;Line 2 of File&lt;/option&gt;
      &lt;option value="3"&gt;Line 3 of File&lt;/option&gt;
          &lt;!-- etc... --&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Some things to keep in mind:</p>
  
  <ul>
  <li>All files are <strong>not</strong> on a server but are rather running from my computer (so I'd guess server-size languages like <code>PHP</code> aren't an option)</li>
  <li>I would like to auto-create an option menu based on the content in 'text.txt'</li>
  <li>The files are in the same directory</li>
  <li>I would not like the user to be able to choose which file to read.  'text.txt' is a file that is made from and filled by another program I have made and is likely to change; that's why I want to read the file every time the page loads.</li>
  </ul>