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

  • Home
  • SEARCH
  • 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 3301998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:48:26+00:00 2026-05-17T20:48:26+00:00

This is a situation I’ve run into several times, not sure what the best

  • 0

This is a situation I’ve run into several times, not sure what the best approach is.

Let’s say I have some kind of dynamic content that users can add to via Ajax. For example, take Stack Overflow’s comments – people can add comments directly on to the page using Ajax.

The question is, how do I implement the addition itself of the new content. For example, it looks like the ajax call which Stack Overflow uses to add a comment, simply returns html which replaces all of the comments (not just the new one). This way saves redundant logic in the Javascript code which has to “know” what the html looks like.

Is this the best approach? If so, how best to implement it in Django so that there is no redundancy (i.e., so that the view doesn’t have to know what the html looks like?)

Thanks!

EDIT: In my specific case, there is no danger of other comments being added in the meantime – this is purely a question of the best implementation.

  • 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-05-17T20:48:27+00:00Added an answer on May 17, 2026 at 8:48 pm

    If the content is simple, I would get JSON and build the HTML in jQuery. If it’s complex, I would create a template and call render() on it on the server and return the HTML (which jQuery could either append to other content or replace existing content).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This situation probably is not entirely uncommon to some of you: you have some
I have run into this situation I find really tricky. I have 2 classes:
I ran into this situation today. I have an object which I'm testing for
I have this situation where I need to get some data from a webpage
I have this situation where I have some pictures: http://www.example.com/test1.jpg http://www.example.com/test2.jpg http://www.example.com/test3.jpg .... some
I have been in this situation quite a few times where visual studio does
I have this situation that I need to let users define decisions based on
In this situation I have two models, Comment and Score. The relationship is defined
I have this situation: $(#button).toggle(function(){ $(#window).animate({top:'0%'},1000); },function(){ $(#window).animate({top:'-100%'},1000); }); but I need change it
I have this situation: http://jsfiddle.net/bRDgK/3/ In this situation I have a modal dialog with

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.