title: CORS error: Turning CSV file into Javascript array
body: <p>I am trying convert a CSV file into a javascript array. In the CSV file, all of the values are on separate lines. Anyway, I found this piece of code in another post on Stackoverflow to turn such a file into an array:</p>
  
  <pre><code>var adressesList = []
  
    $(document).ready(function() {
      $.ajax({
        type: "GET",
        url: "Filepath",
        dataType: "text",
        success: function(data) {
          processData(data);
        }
      });
    });
  
    function processData(allText) {
      var allTextLines = allText.split(/\r\n|\n/);
      for (var i = 1; i &lt; allTextLines.length; i++) {
        adressesList.push(allTextLines[i]);
      }
    }
  </code></pre>
  
  <p>I have tried this but I keep getting an error saying that I am not allowed to access the file (it is local on my computer in the same folder as the code). </p>
  
  <p>This is the error I see:</p>
  
  <pre><code>Access to XMLHttpRequest at 'filepat' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
  
  GET filepath net::ERR_FAILED
  </code></pre>
  
  <p>How could I solve it? I saw that you could put the file on a server. But, shouldn't there just be an easy way to do it locally?</p>
  
  <p>Thank you.</p>