I tried to send some checkboxes values from HTML to Node JS. In my HTML file, I have some checkboxes in a table. I got the checked checkboxes values as following,
$("#createSS").click(function (event) {
event.preventDefault();
var searchIDs = $("#imgTable input:checkbox:checked").map(function () {
return $(this).val();
}).get();
console.log("selected::::" + searchIDs);
});
My HTML form is,
<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>
In Node JS,
app.post('/addSlideShow', function (req, res) {
var $ = req.body;
$('td').each(function () {
console.log($(this).text());
});
});
When I'm clicking the button in HTML, the for isn't submit. How may I fix this?
Thanks in Advance!
Aucun commentaire:
Enregistrer un commentaire