title: Populate dropdown with list of files and download when clicked
body: <p>How can i populate dropdown lists with list of files in a folder and then when a user clicks on the name of the file they download it?</p>
  
  <pre><code> $(document).ready(function () {
      $("#2").empty();
      $("#3").empty();
      $("#4").empty();
      $btn1.hide();
      $.ajax({
          url: '/uploads/docs/' + "name" + ".pdf",
          type: 'HEAD',
          error: function () {
          },
          success: function () {
             e.preventDefault();  
             window.location.href = '/uploads/docs/' + "name" + ".pdf"; 
          }
      });  
   });
  </code></pre>
  
  <p>I have got this which can look in a folder but only for one pdf name and if it exists it downloads a download a pdf. But how do i populate the dropdown and use that? I need to have the user be able to donwload any sort of file .jps .exe etc thanks</p>