Answers for "passing variable in table row delete button node js express"

0

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)
  })
Posted by: Guest on December-30-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language