Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9085473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:15:14+00:00 2026-06-16T21:15:14+00:00

A noob question to be sure. I have a template that has several moving

  • 0

A noob question to be sure. I have a template that has several moving parts and I’m looking for direction on the best way to structure this django response.

Consider the template like this:

<div> Display results of complex_calculation_1 + a button to update the data for this div <\div>

<div> Display results of complex_calculation_2 + a button to update the data for this div <\div>

<div> Display results of complex_calculation_3 + a button to update the data for this div <\div>

<div> Display results of complex_calculation_4 + a button to update the whole page <\div>

The output of each calculation is easily saved. Currently, every time a button is pushed, I re-calculate the particular calculation then re-render the whole page which causes many forloop iterations in all of the parts.

I would like to be able to cache each part of the template in an optimal manner (what would that be?), provide a response which updates only the part of the page which needs to be updated and renders the updated page appropriately.

So my question is: how should I proceed to handle this in a manner which would create the greatest efficiency?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:15:15+00:00Added an answer on June 16, 2026 at 9:15 pm

    Use jquery and ajax to update just the specific part of your template, suppose:

    <div>
        <span id="data_1"> Display results of complex_calculation_1 + </span>
        <button class="data_btn" span_id="data_1">Update</button>
    <\div>
    
    <script>
     $('.data_btn').click(function(){
        // send post data which you need in `data` variable
        $.ajax({
            type: 'POST',
            url: '{% url 'url_name_for_your_view_here' %}',
            data: {'csrfmiddlewaretoken': '{{csrf_token}}'},
            dataType: "text",
            success: function(response) {
                $($(this).attr('span_id')).text(response.data);
                //where response.data is the data which you want to display
            },
            error: function(rs, e) {
                alert(rs.responseText);
                alert('Oops! something went worng..');
             }
         });
      });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A noob question I'm sure. For example, say I have a program that looks
Noob question here! I have an array with hashes that looks like this: arr
I'm sure this is a very noob-ish question, but I've been looking for this
I'm pretty sure that this question is very noob but I'm not used to
Noob question, apologies. I'm compiling Java in Windows Vista's command-line and have so many
Noob question. I have an activate handler in a child List , but it
This is probably a noob question that I will get slated for but here
Question: Hello All, Sorry that this is kind of a noob question. I just
(ruby noob here..apologies if I'm not asking the question correctly) So I have two
I'm not sure where the problem is... I have an ajax request that checks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.