Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
Cómo mostrar datos de json en HTML usando la tabla js

¿Cómo puedo insertar este código en la tabla js?

 if (data.players.length) {data.players.forEach((ply)=>{ let plycont = document.createElement('div') let plyspan = generate_colored_span(ply.name) plyspan.className = 'tracker_plyname' plycont.appendChild(plyspan) plycont.appendChild(wrap_span(ply.score, 'tracker_plyscore')) plycont.appendChild(wrap_span(ply.ping == '0' ? 'BOT' : ply.ping, 'tracker_plyping')) tracker_playerslist.appendChild(plycont) })}

Datos de API JSON que quiero usar: "jugadores":[ { "nombre":"", "puntuación":"", "ping":"" }]

Salida HTML:

 <table class="table"> <thead> <tr> <th>Players</th> <th>Score</th> <th>Ping</th> </tr> </thead> <tbody></tbody> </table>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede crear crear tabla y

 const addRow = (el, data) => { if (data.length) { data.forEach((ply) => { const row = document.createElement("tr"); row.innerHTML = ` <td>${ply.name}</td> <td>${ply.score}</td> <td>${ply.ping}</td> `; el.appendChild(row); }); } }; const table = document.querySelector("tbody"); const data = [ { name: "Player 1", score: "100", ping: "100", },{ name: "Player 2", score: "200", ping: "200", } ]; addRow(table, data);
 td { padding: 4px 24px; }
 <table class="table"> <thead> <tr> <th>Players</th> <th>Score</th> <th>Ping</th> </tr> </thead> <tbody></tbody> </table>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!