Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
How to show image in the table having the knowing the name of this

How can I show the image in the table knowing its name?

I explain better; I have a table with three fields, id, title and image. In the image I am shown the name. but I need the image to be shown.

How can I fix this?

 let table = document.getElementById("my-table");

        var xmlhttp = new XMLHttpRequest();
        var url = "https://r2f5k3e89j.execute-api.us-east-2.amazonaws.com/articles";
        xmlhttp.onreadystatechange = function () {
            var innerXmlhttp;
            if (this.readyState == 4 && this.status == 200) {
                var allart = JSON.parse(this.responseText);
                console.log(allart);
                allart.Items.forEach(item => {
                    let child = document.createElement("tr");
                    child.innerHTML = `
                    <td>${item.id}</td>
                    <td>${item.title}</td>
                    <td>${item.image}</td>`;
                    table.appendChild(child);
                })
            }
        };
        xmlhttp.open("GET", url, true);
        xmlhttp.send();
    <table id="my-table" width="90%">
        <tr>
            <th>Id</th>
            <th>Title</th>
            <th>Image</th>
        </tr>

    </table>

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You should use image tag to do so

 let table = document.getElementById("my-table");

        var xmlhttp = new XMLHttpRequest();
        var url = "https://r2f5k3e89j.execute-api.us-east-2.amazonaws.com/articles";
        xmlhttp.onreadystatechange = function () {
            var innerXmlhttp;
            if (this.readyState == 4 && this.status == 200) {
                var allart = JSON.parse(this.responseText);
                console.log(allart);
                allart.Items.forEach(item => {
                    let child = document.createElement("tr");
                    child.innerHTML = `
                    <td>${item.id}</td>
                    <td><a href="http://google.com">${item.title}</a></td>
                    <td><img src='${item.image}' alt='Something' /></td>`;
                    table.appendChild(child);
                })
            }
        };
        xmlhttp.open("GET", url, true);
        xmlhttp.send();
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can show image by using its source url. For example, if your image url which is coming from response json is https://example.com/image/urlthen you can show it by using this url like that:

<img src="https://example.com/image/url"/></td>`;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda