Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

440
Vistas
Refresh html DIv in Django

i am trying to refresh an {%extends%} page since my base.html is getting message information from whatever is happening in the python backend, it only shows the message after i refresh my page and i want to refresh it every x seconds so the alerts will show without needing to refresh my entire page.

    <div id="Mydiv">
{% extends 'crodlUSDT/base.html'%}
</div>
<script>
$(document).ready(function()
    {
        function refresh()
        {
            var div = $('#Mydiv'),
                divHtml = div.html();

            div.html(divHtml);
        }

        setInterval(function()
        {
            refresh()
        }, 3000); //300000 is 5minutes in ms
    })
</script>

this is what i've found online but tested a lot of different things but none are working, is this possible ? thanks

ive also tried doing this inside of my html file

    <div id="messages" class="messages">
    {% if messages %}
    {% for message in messages %}
    <div class = "alert alert-{{message.tags}}">{{message}}</div>
    {% endfor %}
    {% endif %}
</div>
<script>
    $(document).ready(function()
        {
            function refresh()
            {
                var div = $('#messages'),
                    divHtml = div.html();
    
                div.html(divHtml);
            }
    
            setInterval(function()
            {
                refresh()
            }, 3000); //300000 is 5minutes in ms
        })
    </script>

but also only shows the message after page refresh

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda