In a certain part of my code I need to make a request using javascript with several identical ids.
The problem is that it is overwriting the ids with the last one selected.
My Html:
<button class="btn btn-default border-none" v-on:click="massDelete()" style="width: 100%">
Apagar
</button>
<td class="text-center">
<input type="checkbox" v-on:click="pushId(property.id)">
</td>
My java script;
pushId(propertyid)
{
this.ids.push({property_id: propertyid});
},
massDelete()
{
var obj = {};
for(let item of this.ids)
{
obj = {property_id: item.property_id};
}
console.log(obj);
}
}
I need the answer to be
array({
"property_id": 3
}
{
"property_id": 4
}
{
"property_id": 5
})
PS: I can not use a form because of layout layout