Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

447
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!