码迷,mamicode.com
首页 > Web开发 > 详细

js端table转csv

时间:2015-01-22 15:55:27      阅读:831      评论:0      收藏:0      [点我收藏+]

标签:js端table转csv table2csv.js


index.jsp

function getCSVData(){

      //tablesorter就是要导出的table

       var csv_value=$(‘#tablesorter‘).table2CSV({delivery:‘value‘});

       //$("#download_schedule").attr("href","./download_schedule.jsp?csv_value=‘"+csv_value+"‘");

       $("#csv_text").val(csv_value); 

   }


<form  action="download_schedule.jsp" method ="post" target="_blank"> 

  <input type="hidden" name="csv_text" id="csv_text">

  <input type="submit" value="csv出力" /></td>

</form>


download_schedule.jsp

<%@ page language="java" import="java.util.*,java.lang.*" pageEncoding="shift_jis"%>

 <% 

response.setHeader("Content-type","application/octet-stream;charset=shift_jis");

response.setHeader("Content-Disposition","attachment; filename=\"work table.csv\"");

String value = request.getParameter("csv_text");

out.println(value);

%>


table2csv.js下载链接

http://download.csdn.net/detail/le5le/8385143


js端table转csv

标签:js端table转csv table2csv.js

原文地址:http://9873782.blog.51cto.com/9863782/1606860

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!