【发布时间】:2012-12-28 17:23:05
【问题描述】:
我需要使用 jQuery 获取以下 html 表的检查行的 JSON
JSON 应该包含用户在文本框中输入的 cmets。 任何指针都会对我有所帮助。
<table id="potable_grid" class="tab">
<thead>
<tr>
<th>
select PO
</th>
<th>
po id
</th>
<th>
ponumber
</th>
<th>
pocurrency
</th>
<th>
balance
</th>
<th>
thisinvoice
</th>
<th>
thisinvoiceinInvoicecurrency
</th>
<th>
comments
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" id="chckPO" />
</td>
<td>
po001
</td>
<td>
cuspo1
</td>
<td>
usd
</td>
<td>
10000
</td>
<td>
200
</td>
<td>
2
</td>
<td>
<input type="text" id="txtPO" />
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="chckPO" />
</td>
<td>
po002
</td>
<td>
pocus125
</td>
<td>
inr
</td>
<td>
5000
</td>
<td>
300
</td>
<td>
18000
</td>
<td>
<input type="text" id="txtPO" />
</td>
</tr>
</tbody>
</table>
我查看过很多帖子,例如 HTML Table to JSON
但它适用于行没有任何控制的简单 html 表。
【问题讨论】:
-
请注明。不可读。
-
不完全确定您想要什么。您只需要将表格转换为 JSON 对象?只是cmets?还是两者兼而有之?
-
可爱,但你真正想要的输出是什么? 请,阅读Markdown help page,inline代码(包装在
`中)和...代码blocks(每行缩进四个空格加进一步缩进以实际缩进代码行)。 -
@ Leeish 我想要选定行的所有值的 json,包括文本框中的 cmets。 @Ricardo/David 抱歉识别。这是我对 stackoverflow 的第一个问题。
标签: jquery html json html-table