Tengo un código que me gustaría actualizar (refrescar) si mi archivo ha sido modificado desde entonces y está en un bucle, por lo que seguiría intentando impulsarlo, ¿alguien puede ayudarme a hacerlo funcionar? aquí está el código;
<script> var checkUrl="messages.php"; window.setInterval("checkForUpdate()", 1000); var pageLoad = new Date().getTime(); function checkForUpdate() { $.ajax(checkUrl, { type : 'HEAD', success : function (response, status, xhr) { if(firstCheck === false) { firstCheck = true; return; } var lastModified = new Date(xhr.getResponseHeader('Last-Modified')) .getTime(); if(lastModified > pageLoad) { window.location.replace("./"); } } }); } </script>