2021-03-29

How do I can get back the value of these table cells?

I got this function for a CRUD to recive some data and charge it to the html:

async function loaded() {
  let data = await getRequest('http://localhost/ALMACEN/Backend/get.php');

  document.getElementById("imagen").innerHTML = 
    '<img src="Front-End/imagenes/'+ data.data[0].prod_img +'" width="50%"; height= "auto";>';

  for(var i=0;i<data.data.length;i++){
    var table = document.getElementById("employeeList").getElementsByTagName('tbody')[0];
    var newRow = table.insertRow(table.length);
    cell1 = newRow.insertCell(0);
    cell1.innerHTML = data.data[i].prod_nombre;
    cell2 = newRow.insertCell(1);
    cell2.innerHTML = data.data[i].prod_precio;
    cell3 = newRow.insertCell(2);
    cell3.innerHTML = data.data[i].prod_cantidad;
    cell4 = newRow.insertCell(3);
    cell4.innerHTML = `<a href="#" class="opis" style="background-color: #3ebd49;">&#129089</a>
                       <a href="#" class="opis" style="background-color: #f57c0a;">&#129087</a>
                       <a href="#" onclick="eliminar(this)" class="opis" style="background-color: #A50202;">Borrar</a>`;
  }

}

I wanna get back the values to make the Delete button work, what can I do?



from Recent Questions - Stack Overflow https://ift.tt/2QIpshv
https://ift.tt/eA8V8J

No comments:

Post a Comment