Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
i want to add json data to html table

again very basic question i know but i dont know why my code isnt working im buliding an electron app from scratch and i learning these skills from internet only so i have only you guys to ask questions :p

document.getElementById("arrBtn").addEventListener("click", async function (event) {

            getData = await window.api.GetRow()

            let bigArr = document.getElementById("arr").innerHTML = getData;            
        });

the above code giving me a stringyfied array of objects in my html on click event but when im trying to convert those object into row in a table nothing happening on click codes are below

document.getElementById("arrBtn").addEventListener("click", async function (event) {

            // const myArr = async () => {
            getData = await window.api.GetRow()

            let bigArr = document.getElementById("arr").innerHTML = getData;  
            
            function buildTable(data){
            let table = document.getElementById("myTable");
            for (let i = 0; i < data.length; i++) {
                let line = `<tr>
                        <td>${data[i].name}</td>
                        <td>${data[i].property}</td>
                    </tr>`
                    table.innerHTML += line
            }
        }

        buildTable(getData);
        });

i have already created table and table head in html i just want to add rows in my existing table below is my html

<table class="responsive-table striped">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Property</th>

                        </tr>
                    </thead>

                    <tbody id="myTable">
                        <tr>
                            <td>Alvin</td>
                            <td>Eclair</td>

                        </tr>
                    </tbody>
            </table>

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda