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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码
    • ¥50 随机森林与房贷信用风险模型
    • ¥50 buildozer打包kivy app失败
    • ¥30 在vs2022里运行python代码