is it possible to merge multiple serializeobject to one serializeobject? I will be using it in a post. The serializeobjects are created via for loop.
var data = [];
for (var i = 0; i < riid_count; i++) {
data[i] = $('input[type=checkbox][data-record='+i+']').serializeObject();
data[i].id = $('input[name=id][data-record='+i+']').val();
console.log(data[i]);
}
$.ajax({
url : '<?php echo base_url() . 'index.php/unsubscribe/submit' ?>',
data: data (hopefully access the merged objects),
method: "POST",
processData: true,
dataType: 'json',
error: function(xhr, status, thrown)
{
// i have stuff here
},
success: function(data)
{
// i have stuff here
}
});
And here is an example of how the <form>
element could look:
<form>
<input type="checkbox" data-record="0" class="selection" name="somename">
</form>
Depending on the data I get from the database there can be up to 10 (or even more) checkboxes.