Created
March 4, 2022 11:37
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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