title: How To Open Download Dialog box in Javascript?
body: <p>I make  function in Aspx page  and call this function from java script , Now i want to download  files through Java script. But Download Dialog Doesn't Open.....</p>
  
  <p><strong>Download.Aspx:</strong></p>
  
  <pre><code>            string pid = Request.QueryString["Did"].ToString();
  
              DataTable dt;
              dt = common.GetFilePath(Convert.ToInt64(pid));
              FilePath = dt.Rows[0]["FilePath"].ToString();
              FileName = dt.Rows[0]["FileName"].ToString();
              FilePath = System.Web.HttpContext.Current.Server.MapPath("~//" + FilePath +    "");
  
              Response.Clear();
              Response.ClearHeaders();
              Response.ContentType = "application/ms-excel";
              Response.AddHeader("content-disposition", "attachment; filename=" + FileName + "");
              Response.WriteFile(FilePath);
              Response.End();
  </code></pre>
  
  <p><strong>Jquery:</strong></p>
  
  <pre><code>function DownloadAttach(pid){
  
     $.ajax({ type: "POST",
              url: "http://localhost:1988/DownLoad.aspx?Did=" + pid,
              dataType: "xml",
  
              processData: true,
              //error: function(XMLHttpRequest, textStatus, errorThrown) { ajaxError(XMLHttpRequest, textStatus, errorThrown); },
              success: function(xml) {
  
                //ShowMsg("projSaveMsg", "Attachment Deleted.");
              }
          });        
  
  }
  </code></pre>