title: How to print all the txt files inside a folder using java script
body: <p>I need to print all the txt files from a directory inside an HTML using javascript.
  i tried to modify a code dealing with photos but I didn't success</p>
  
  <p><a href="https://stackoverflow.com/questions/18480550/how-to-load-all-the-images-from-one-of-my-folder-into-my-web-page-using-jquery">How to load all the images from one of my folder into my web page, using Jquery/Javascript</a></p>
  
  <pre><code>var dir = "D:\Finaltests\test1\new\places";
  var fileextension = ".txt";
  $.ajax({
      //This will retrieve the contents of the folder if the folder is configured as 'browsable'
      url: dir,
      success: function (data) {
          //List all .txt file names in the page
          $(data).find("a:contains(" + fileextension + ")").each(function () {
           var filename = this.href.replace(window.location.host, "").replace("http://", "");
          $("body").append("&lt;input type='file' onload='readText(" + dir + ")&gt;");
  
  
          });
      }
  });
  </code></pre>