title: Read csv directly from url in html using js
body: <p>I am working on html &amp; js in which i display yahoo finance stock in table format. The data get in csv. I want js directly read data from url  </p>
  
  <p>The url is <a href="http://ichart.finance.yahoo.com/table.csv?s=RIL.BO" rel="nofollow">http://ichart.finance.yahoo.com/table.csv?s=RIL.BO</a> </p>
  
  <p>The code i try which i get from stackoverflow is working in localhost url.</p>
  
  <pre><code> var txtFile = new XMLHttpRequest();
      txtFile.open("GET", "http://ichart.finance.yahoo.com/table.csv?s=RIL.BO", true);
      txtFile.onreadystatechange = function() {
        if (txtFile.readyState === 4) {  // Makes sure the document is ready to parse.
          if (txtFile.status === 200) {  // Makes sure it's found the file.
            allText = txtFile.responseText;
            lines = txtFile.responseText.split("\n"); // Will separate each line into an array
            alert(allText);
          }
        }
      }
  </code></pre>
  
  <p>Thanks </p>