【发布时间】:2015-05-18 07:19:16
【问题描述】:
我尝试将一些复选框值从 HTML 发送到 Node JS。在我的 HTML 文件中,我的表格中有一些复选框。我得到如下选中的复选框值,
$("#createSS").click(function (event) {
event.preventDefault();
var searchIDs = $("#imgTable input:checkbox:checked").map(function () {
return $(this).val();
}).get();
console.log("selected::::" + searchIDs);
});
我的 HTML 表单是,
<form action="/addSlideShow" method="POST">
<table id="imgTable" class="table">
{{#images}}
<tr>
<td><input id={{imgURL}} type="checkbox" name="ch" value={{imgURL}}/></td>
</tr>
{{/images}}
</table>
<input id="createSS" type="submit" value="Create Slide Show" class="btn btn-success pull-left" disabled/>
</form>
在 Node JS 中,
app.post('/addSlideShow', function (req, res) {
var $ = req.body;
$('td').each(function () {
console.log($(this).text());
});
});
当我单击 HTML 中的按钮时,for 未提交。我该如何解决这个问题?
提前致谢!
【问题讨论】:
标签: javascript jquery html node.js checkbox