使
用開源插件Table-to-json:
官方地址:http://lightswitch05.github.io/table-to-json/
功能說明:將js對象table轉換成javascript對象,輸出json數據字符串。
1.引用
<script type="text/javascript" src="
http://code.jquery.com/jquery-latest.js"></script
>
<script type="text/javascript" src="../src/jquery.tabletojson.js"></script>
2.插入
<script> $('#convert-table').click( function() { var table = $('#example-table').tableToJSON(); // Convert the table into a javascript object console.log(table); alert(JSON.stringify(table)); }); </script>