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 8066395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:59:03+00:00 2026-06-05T11:59:03+00:00

I implemented Django ajax comment submission in my app using Nick Carroll’s method here

  • 0

I implemented Django ajax comment submission in my app using Nick Carroll’s method here. I’d like the user that posted the comment, date of submission and comment to appear on the page using ajax after the server has received and saved it. What’s a good way to do this?

  • 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-05T11:59:04+00:00Added an answer on June 5, 2026 at 11:59 am

    Alright this is kind of a hackerish way to go about this, but I think I’ve figured out a decent solution:

    <script type="text/javascript" charset="utf-8">
        function bindPostCommentHandler() {
            $('#comment_form form input.submit-preview').remove();
            $('#comment_form form').submit(function() {
                var comment_text = $('#id_comment').val();
                $.ajax({
                    type: "POST",
                    data: $('#comment_form form').serialize(),
                    url: "{% comment_form_target %}",
                    cache: false,
                    dataType: "html",
                    success: function(html, textStatus) {
                        $('#comment_form form').fadeTo(500, 0, function(){
                            $(this).remove();
                        });
    
                        var today = new Date();
                        var dd = today.getDate();
                        var mm = today.getMonth()+1;
                        var yyyy = today.getFullYear();
                        if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} var today = mm+'/'+dd+'/'+yyyy;
                        var comment = "<div class='comment'><h4>User " + "\"{{ user.username }}\"" + " Rating <small>" + today + "</small></h4>" + comment_text + "</div><hr />";
                        $(comment).hide().prependTo("#comments_loc").fadeIn(1000);  
                        bindPostCommentHandler();
                    },
                     error: function (XMLHttpRequest, textStatus, errorThrown) {
                        $('#comment_form form').replaceWith('Your comment was unable to be posted at this time.  We apologize for the inconvenience.');
                     }
               });
            return false;
        });
    }
    
    $(document).ready(function() {
        bindPostCommentHandler();
    });
    </script>
    

    I’m relatively new to javascript so I put this together with what little I know. Feel free to leave some comments if you think this could be cleaned up.

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

Sidebar

Related Questions

I have a django app that I made and have implemented a plist into
I implemented the user login/registration using Django's authentication system but hit the wall and
I would like to build a Django app that allows searching for a movie
I implemented a django custom authentication backend. My authenticate() returns a user object like
I implemented a simple sitemap class using Django's default sitemap application. As it was
I'm using this django app to implement PayPal IPN. I'm testing it using PayPal's
I was considering how one would implement some voting mechanism, using AJAX, that limits
In django, I would like to reference the class whose method is being called,
I have successfully implemented django-ajax-uploader into my project. But I do not know how
I have implemented a registration/login/authentication system using this Django guide . But, how would

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.