Tutoriales de Informática y Dispositivos Móviles
Tutoriales de Informática y Dispositivos Móviles
Update page jQuery

Update page with jQuery

Update page with jQuery

Today we’ll learn how to update our page using the JavaScript function location.reload and jQuery

JavaScript reload function

The easiest way to reload a page is the JavaScript function window.location.reload

Lest see an example

<body>
  <!--Update button-->
  <input type="button" id="update-page" value="Update">
</body>
<script>
  // When all the page is charged
  $(document).ready(function(){
    // Button event
    $("#update-page").click(function(){
      // Reload the page
      location.reload();
    });
  });
</script>

Other reload methods

There are other ways to reload the page. Let´s see someone

window.location = location.href;
location = location;
location = window.location;
location = self.location.href;

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.

Translate »
A %d blogueros les gusta esto: