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

90
Views
cómo recargar un elemento específico con js

Solo quiero saber cómo puedo recargar un elemento específico o div con código javascript.

división:

 <div id="profile_img"> <figure> <img id="holla" src="avatar.gif"/> </figure> </div>

Espero que ayudes. Lo necesito de verdad . Gracias

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puede configurar fácilmente la fuente de una imagen en JS:

document.getElementById("holla").src = "avatar.gif";

 function refresh() { document.getElementById("holla").src = "avatar.gif"; }
 <div id="profile_img"> <figure> <img id="holla" src="avatar.gif"/> </figure> </div> <button onclick="refresh();">Refresh Image</button>

about 4 years ago · Juan Pablo Isaza Report

0

Si está intentando recargar desde el servidor, puede hacer una llamada ajax y configurar la respuesta a ese div. document.getElementById('holla').innerHTML = this.responseText;

about 4 years ago · Juan Pablo Isaza Report

0

Debe tener algún mecanismo para cargar la imagen. La llamada Ajax cargará la imagen de forma asíncrona.

 // Create an XMLHttpRequest object const xhttp = new XMLHttpRequest(); // Define a callback function xhttp.onload = function() { //you get response back from server in responseText. document.getElementById('holla').innerHTML = this.responseText; } // Send a request xhttp.open("GET", "ajax_info.txt");// path to file xhttp.send();
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!