This is what I have:
<input type="checkbox" name="selectedId[{{ order.id }}]">
const orders = [];
$("input[type=checkbox][name*='selectedId']:checked").each(function (index) {
let id = $(this).attr('name').match(/[-0-9]+/);
orders[index] = id[0];
});
And I get:
orders = [0 => 1, 1 => 2]
What I would like to get is:
orders = [
0 => ["id" => 1],
1 => ["id" => 2]
];
orders[index]["id"] = id[0] doesn't work
orders[index] = { id: id[0] };