Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
  })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #passing #variable #table #row #delete #button #node #js #express
ADD COMMENT
Topic
Name
2+2 =