title: Using Jquery and Ajax to save a file in ASP.Net
body: <p>I have a button that uses jQuery and ajax to call a server side script to create a text file and sends back the following response:</p>
  
  <pre><code>Response.ContentType = "csv";
  Response.AddHeader("Content-disposition", "attachment; filename=" + fName);
  Response.ContentType = "application/octet-stream";
  Response.BinaryWrite(btFile);
  Response.End();
  </code></pre>
  
  <p>However, the save dialog does not appear.
  If I don't use ajax and perform a full postback with the same code, it works. Any ideas?</p>
  
  <p>Here is the jQuery code:</p>
  
  <pre><code>$(function() {
      $('#reportButton').click(function() {
          $.ajax({
              type: "POST",
              url: "GenerateReport.aspx",
              data: "id=0",
              success: function(){
              }
          });
      });
  });
  </code></pre>