title: How to force download a file with JavaScript?
body: <p>I have a <code>jQuery ajax</code> form where a user submits his email, once the form has been submitted, the user should get an automated download of a file, the form looks like this:</p>
  
  <pre><code>$(".email-form").submit(function(event) {
      event.preventDefault();
  
      var $form = $(this),
      form_email = $form.find("input[name='email']").val(),
      url = $form.attr("action");
  
      var posting = $.post(url, { email: form_email });
  
      posting.done(function() {
          $(".popup-design").hide();
          $("input[name='email']").val("");
          $("#done").show();
      });
  });
  </code></pre>
  
  <p>and also I need to have to user automatically download a file of my choice when <code>posting</code> is <code>done</code>. How can I do that?</p>