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

327
Vistas
How to insert an image in javascript when calling XML data?

I have data in an XML and I want to display it in a table in my HTML page. I can display my values, and I can even display the url of my image. I thought, I just need to add the <img> tag, but when I add the latter, I can't see anything.

function myFunction(xml) {
  var i;
  var xmlDoc = xml.responseXML;
  var table="<tr><th>Transporter</th><th>Type</th><th>Logo</th></tr>";
  var x = xmlDoc.getElementsByTagName("data");
  for (i = 0; i <x.length; i++) {
    table += "<tr><td>" +
    x[i].getElementsByTagName("transporter")[0].childNodes[0].nodeValue +
    "</td><td>" +
    x[i].getElementsByTagName("type")[0].childNodes[0].nodeValue +
    "</td><td>" + "<img src=\""
    x[i].getElementsByTagName("logo")[0].childNodes[0].nodeValue +
    "\"> </td></tr>";
  }
  document.getElementById("transporterlist").innerHTML = table;
} 

Do you think this is not possible? Thanks

about 4 years ago · Juan Pablo Isaza
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