title: How to retrieve the file names from a given folder
body: <p>Here I'm trying to get the list of all file names from a given directory.At this url (<a href="http://localhost:3000/dir" rel="nofollow">http://localhost:3000/dir</a>), I'm having the directory name as "/usr/local".</p>
  
  <p>I'm trying to retrieve all the files from "/usr/local" directory having extension ".txt".</p>
  
  <p>I'm unable to display the file names due to the following error :   </p>
  
  <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://localhost:3000/dir" rel="nofollow">http://localhost:3000/dir</a>. (Reason: CORS header 'Access-Control-Allow-Origin' missing).How can I overcome this issue.Can anyone please help me out ...</p>
  
  <p>My Sample.html :</p>
  
  <pre><code>&lt;html&gt;
  &lt;script src="https://code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;body&gt;
  
  &lt;div id="fileNames"&gt;&lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  $(window).load(function(){
     var fileExt = ".txt";
  
          $(document).ready(function(){
  
              $.ajax({
  
                  url: 'http://localhost:3000/dir',
                  success: function (data) {
                      console.log(data);
                     $("#fileNames").html('&lt;ul&gt;');
  
                      $(data).find("a:contains(" + fileExt + ")").each(function () {
                          $("#fileNames").append( '&lt;li&gt;'+$(this).text()+'&lt;/li&gt;');
                      });
                      $("#fileNames").append('&lt;/ul&gt;');
                  }
              });
  
          });
  });
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>