weixin_33701251 2016-11-04 06:29 采纳率: 0%
浏览 418

php ajax导出到excel

wanted to ask you for a little help. I have small script, which returning search results:

 $(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;  
      });  
 }); 

And it also exporting result on excel after button click, but on lager amont of data, I getting error Request-URI Too Large. I can not figure out, how to turn excel export to post reques. Could you help me please. Here is code of excel.php file:

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

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

echo $_GET["data"];
  • 写回答

0条回答 默认 最新

    报告相同问题?