title: Export data to excel is not working
body: <p>I am using Infragistics Excel Export framework for exporting data to excel through ajax post </p>
  
  <p>Here is code at client side</p>
  
  <pre><code>  $.ajax({
          type: 'post',           
          url: '../Common/ExcelExporter',
          data: {
              tbname: parameter, pageNumber: _pageNumber, pageSize: _pageSize
              , exportType: true, exportFormat: true
          },
          success: function (res, status, xhr) {
          alert(JSON.stringify(xhr));
      }
      });
  </code></pre>
  
  <p>and the code at controller side</p>
  
  <pre><code>public void ExcelExporter(string tbname,int pageNumber, int pageSize, bool exportType, bool exportFormat)
  {
      pageNumber++;
      IEnumerable exportdata = dbList.getClass(tbname);
      bool exportAllPages = exportType;
  
      if (exportdata == null) {
          var obj = Activator.CreateInstance(Assembly.GetExecutingAssembly().GetType(assemblyName + ".Models." + tbname));        
  
          if (exportAllPages)
          {
             exportdata = (from e in dbList.getClass(tbname).AsQueryable() select e).AsQueryable();
          }
          else
          {
              exportdata = (from e in dbList.getClass(tbname).AsQueryable() select e).AsQueryable().Skip(pageNumber).Take(pageSize);
          }
  
      WorkbookFormat excelFormat;
  
      if (exportFormat)
          excelFormat = WorkbookFormat.Excel2007;
      else
          excelFormat = WorkbookFormat.Excel97To2003;
  
      ExcelExportingModel exportModel = new ExcelExportingModel(excelFormat);
      exportModel.PopulateExcelWorkbook(exportdata);
      SendForDownload(exportModel.ExcelWorkbook, excelFormat);            
  }
  
  [SecuritySafeCritical]
  private void SendForDownload(Workbook document, WorkbookFormat excelFormat)
  {
      string documentFileNameRoot;          
      documentFileNameRoot = string.Format("Document.{0}", excelFormat == WorkbookFormat.Excel97To2003 ? "xls" : "xlsx");           
      Response.Clear();
      Response.AppendHeader("content-disposition", "attachment; filename=" + documentFileNameRoot);
      Response.ContentType = "application/octet-stream";           
      document.SetCurrentFormat(excelFormat);
      document.Save(Response.OutputStream);       
      Response.End();           
  }
  </code></pre>
  
  <p>The code is executing without any error but there is no output.No file is being downloaded.
  when i checked the response from the controller i am getting this</p>
  
  <p>Output:</p>
  
  <pre><code>{
   "readyState":4,
   "responseText":"PK\u0002\u\&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"&gt;&lt;Relationship Type= \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\" Target=\"docProps/app.xml\" Id=\"rId1\" /&gt;&lt;Relationship Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\"Target=\"docProps/core.xml\" Id=\"rId2\" /&gt;&lt;Relationship Type= \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"Target=\"xl/workbook.xml\" Id=\"rId3\" /&gt;/Relationships&gt;PK\u[Content_Types].xmlPK\u0005\u0000",
   "status":200,
   "statusText":"OK"
  }
  </code></pre>
  
  <p>I have taken reference for code from this <a href="http://www.igniteui.com/infragistics-excel/overview" rel="nofollow"><b>link</b></a></p>
  
  <p>Please help to solve this</p>