php ajax导出到excel

php ajax导出到excel,php,ajax,excel,export,Php,Ajax,Excel,Export,我想请你帮忙。我有一个小脚本,返回搜索结果: $(document).ready(function(){ $('#search_text').keyup(function(){ var txt = $(this).val(); if(txt != '') { $.ajax({ url:"fetch_nod.php",

我想请你帮忙。我有一个小脚本,返回搜索结果:

 $(document).ready(function(){  
      $('#search_text').keyup(function(){  
           var txt = $(this).val();  
           if(txt != '')  
           {  
                $.ajax({  
                     url:"fetch_nod.php",  
                     method:"post",  
                     data:{search:txt},  
                     dataType:"text",  
                     success:function(data)  
                     {  
                          $('#result').html(data);  
                     }  
                });  
           }  
           else  
           {  
                $('#result').html('');                 
           }  
      });
      $('#create_excel').click(function(){  
           var excel_data = $('#nod_dat2').html();  
           var page = "excel.php?data=" + excel_data;  
           window.location = page;  
      });  
 }); 
它也会在点击按钮后将结果导出到excel中,但在数据量较大的情况下,我得到的错误请求URI太大。我不知道如何将excel导出转换为post请求。你能帮帮我吗。下面是excel.php文件的代码:

header('Content-Type: application/vnd.ms-excel');  

header('Content-disposition: attachment; filename='.rand().'.xls');  

echo $_GET["data"];
检查apache的。也许会有帮助