passing variable in table row delete button node js express code example
Example: passing variable in table row delete button node js express
<button class="delete-button" onclick="deleting(<%= item._id %>)">X</button>
function deleting(value){
fetch('/delete', { method: 'POST', data: {buttonId: value} })
.then(function (response) {
if (response.ok) {
console.log('Delete was recorded')
return
}
throw new Error('Request failed.')
})
.catch(function (error) {
console.log(error)
})