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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:42:44+00:00 2026-05-21T03:42:44+00:00

So I have the ability to post comments on my site. User enters a

  • 0

So I have the ability to post comments on my site. User enters a field hits “post” and i ajax the comment back to the database which is dealt with it in this Action result

public ActionResult PostComment(Comment NewComment)
    {
        var repository = GetRepository<Comment>();
        var player = GetPlayer();
        //we have this stuff
        NewComment.Created = DateTime.Now;
        NewComment.Updated = NewComment.Created;
        NewComment.Live = true;
        NewComment.Player = player;

        repository.Add(NewComment);

        return new JsonResult { Data = new { Success = true, Comment = new CommentSummary(NewComment, player) } };
    }

This is the reuturned to my jquery which uses jquery template to display the comment on the page

 $.post("/comments/PostComment", data, function(json) {
        if(json.Success){              
            var newComment = [
              {
                Id: json.Comment.id,
                postedOn: json.Comment.postedOn,
                postedBy: json.Comment.postedBy,
                body: json.Comment.body
              }
            ];

            /* Compile markup string as a named template */
            $.template("TmplComment", $("#CommentTemplate").html());

            /* Render the named template */
            $.tmpl("TmplComment", newComment).prependTo("#AllComments");

            //Do some tidying
            $('#Comments_HasComments').show();
            $('#Comments_HasNoComments').hide();
            $("#frmPostComment textarea[name='comment']").val('')

            //go to your comment
            $("#Comment_" + json.Comment.id).animate({backgroundColor: "#F4FF8C"}, 1000 ).animate({backgroundColor: "#ffffff"}, 1000 );
            location.href = "#Comment_" + json.Comment.id;
        }                        
    });

for some reason I am having HTML encoded issues as any enters the user has entered will be converted to
when posted back down but the jquery template puts them onto the page in full view instead of being just part of the code

is there something i need to turn on/off??

  • 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-21T03:42:44+00:00Added an answer on May 21, 2026 at 3:42 am

    Are you using the {{html}} template tag for the comment body?

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

Sidebar

Related Questions

I have an ASP.NET site which I'd like to add page-level comments to without
I'd like to have ability to resize pictures on my site. Algorithm: You upload
In my web application users have the ability to upload games which are then
I have a web application where users can add recommendations , post comments etc
I have a cms in which admins of my page log in and post
I have an object that represent's a User's account on my site, and a
I'm creating a small service, which needs to have ability for custom themes. I
I see that some C libraries have ability to specify custom memory allocators (
I need to have the ability to use superscripts asnd subscripts in a QLineEdit
Is Delphi have any ability to write script of IDE actions? I would like

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.