Skip to content

Instantly share code, notes, and snippets.

@eduard01982
Created March 4, 2022 11:37
Show Gist options
  • Save eduard01982/e0de55bb6d776b4bb7d6ddbdfc0c71ea to your computer and use it in GitHub Desktop.
Save eduard01982/e0de55bb6d776b4bb7d6ddbdfc0c71ea to your computer and use it in GitHub Desktop.
Refrescar solo una parte de una pagina web, con un div y jquery
$(document).ready(function () {
var interval = 500; //número de milisegudos en que vuelve a hacer la llamada de la función.
var refresh = function() {
$.ajax({
url: "path/to/server/page.php",
cache: false,
success: function(html) {
$('#server-name').html(html);
setTimeout(function() {
refresh();
}, interval);
}
});
};
refresh();
});
<div id="server-name"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment