title: Only last file is downloaded with iterated form.submit() action
body: <p>I only get the last file downloaded from the form <code>submit()</code>, whereas I expect multiple files to be downloaded using the <code>for</code> loop. I'm pretty new to JavaScript and jQuery.  Please help.  </p>
  
  <p>I'm sending a request to a certain Web API URL (<code>WEBAPIURL</code>) which takes a token (<code>TOKEN</code>) for authentication and a file reference number (<code>fileId</code>).  I've provided all of the parameters correctly.  I can download each individual file but cannot download multiple files when sending them through a <code>for</code> loop. Only the last file is downloaded.</p>
  
  <pre><code>for(id in fileIDs){
  
      var form = $('&lt;form&gt;&lt;/form&gt;').attr('action', WEBAPIURL).attr('method', 'post');
      form.append($('&lt;input&gt;&lt;/input&gt;').attr('type', 'hidden').attr('name', "token").attr('value', TOKEN));
      form.append($('&lt;input&gt;&lt;/input&gt;').attr('type', 'hidden').attr('name', "fileId").attr('value', fileIDs[id]));
      form.appendTo('body').submit().remove();
  }
  </code></pre>