title: Download an excel file in JQuery-AJAX request from ASP.NET MVC
body: <p>In my ASP.NET MVC project, I generated a excel file using <a href="http://closedxml.codeplex.com/" rel="nofollow">ClosedXML</a>.</p>
  
  <p>It works well in non-ajax call. Here is my controller action method</p>
  
  <pre><code> // Prepare the response
   Response.Clear();
   Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
   Response.AddHeader("content-disposition", "attachment;filename=\"" + reportHeader + ".xlsx\"");
  
   // Flush the workbook to the Response.OutputStream
   using (MemoryStream memoryStream = new MemoryStream())
   {
       MyWorkBook.SaveAs(memoryStream);
       memoryStream.WriteTo(Response.OutputStream);
       memoryStream.Close();
   }
   Response.End();
  </code></pre>
  
  <p>Now I am trying to do it via an ajax request. But the file is not sent from mvc controller.</p>
  
  <pre><code>$.ajax({
                  url: url,
                  type: "POST",
                  data: fd,
                  processData: false,  
                  contentType: false,  
                  beforeSend: function () {
                  },
                  success: function (response) {
  
                  },
                  error: function (request, status, error) {
                  },
                  complete: function () {
                  }
              });
  </code></pre>
  
  <p>How can i accomplish it? 
  Thank you in advance.</p>