dimanche 1 mars 2015

Serializing checkboxes inside table (datatables)

I'm using jquery datatables, the created table html is:



<table id="product-table">
<tr role="row" class="odd">
<td>
<div class="vd_checkbox">
<input type="checkbox" class="checkbox-group" id="c3800">
<label for="c3800"></label>
</div>
</td> ...
</table>


I'm using this code to serialize checkboxes to be sent via ajax to be processed.



<script type="text/javascript">
var table;
$(document).ready(function () {
table = $('#product-table').DataTable(options);
$('#b_submit').click(function () {
var data = table.$('input').serialize();
alert("The following data would have been submitted to the server: \n\n" +
data.substr(0, 120) + '...');
return false;
});
</script>


But this doesn't serialize any checkbox (alerts the message only). How can I serialize them?





Aucun commentaire:

Enregistrer un commentaire