如何将html表中的项目列表序列化为jason [英] how to serialize list of item in html table to jason

查看:116
本文介绍了如何将html表中的项目列表序列化为jason的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想序列化表格中的项目列表。在java脚本或j查询中是否有任何简短的方法来执行此操作。我知道在java脚本/查询中序列化和序列化数组,但它们不适合我的情况。







product_name product_price product_quantity

x 20 2
$ b $ 22 2

。 。 。

。 。 。

。 。 。

z 21 5

i want to serialize list of item present in the table . is there any short method in java script or j query to do this .I know about serialize and serialize array in java script/query but they do not fit in my case.



product_name product_price product_quantity
x 20 2
y 22 2
. . .
. . .
. . .
z 21 5

推荐答案

您可以使用jQuery从表中获取数据,然后将它们序列化为JSON,如下所示:



http://codepen.io/xszaboj/pen/bVbezz?编辑= 101 [ ^ ] < br $> b $ b

希望它有所帮助
Well you can get data from table using jQuery and then serialize them to JSON like this:

http://codepen.io/xszaboj/pen/bVbezz?editors=101[^]

hope it will help


这篇关于如何将html表中的项目列表序列化为jason的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆