title: Download a file with Javascript via POST
body: <p>I currently use <a href="https://stackoverflow.com/questions/3499597/javascript-jquery-to-download-file-via-post-with-json-data/3506018#3506018">this solution</a> to download excel files via javascript.  When a user clicks a button, my javascript creates a url which I load with an iframe.  This solution works for short urls. However, I've come across a case where my url is too long for a <code>get</code> request.  I'd like to preserve the same behavior such that no new windows open for the excel export.  However, I'd be OK with opening a temporary window if necessary.  I've thought of one solution which I'd like to avoid:</p>
  
  <ol>
  <li>Make a <code>POST</code> request that creates the excel file, saves it to a temp folder, and returns the unique file name.</li>
  <li>Request the file name in a url constructed for the iframe.</li>
  </ol>
  
  <p>I don't like this solution because it requires a non trivial amount of work to setup a temp folder that will be shared across all of our web servers.  Also, I simply would rather not create a temporary file if I don't need to.</p>
  
  <p>current code:</p>
  
  <p><code>$("body").append('&lt;iframe width="0" height="0" frameborder="0" src="' + dynamicallyCreatedUrl + '"&gt;&lt;/iframe&gt;');</code></p>
  
  <p>Is there a way I can make a <code>POST</code> request to download an excel file via javascript?</p>
  
  <p>This solution must work for IE8+, Firefox, Chrome.  Just for reference: I'm using IIS7, ASP.Net MVC, C#. I have access to <code>YUI</code> and <code>JQuery</code>.</p>