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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:39:12+00:00 2026-05-14T02:39:12+00:00

In my xml file comments are listed as <Comments> <CommentID id=1> <CommentBy>efet</CommentBy> <CommentDesc> Who

  • 0

In my xml file comments are listed as

<Comments> 
<CommentID id="1">
<CommentBy>efet</CommentBy>
<CommentDesc>   Who cares!!! My boyfriend thinks the same with me. tell your friends. 
</CommentDesc>
</CommentID>
<CommentID id="2">
<CommentBy>tetto</CommentBy>
<CommentDesc>   xyz.... </CommentDesc>
</CommentID>
</Comments>

I need to append them inside the ul of the div id=”nw-comments”.

<div id="nw-comments" class="article-page">
    <h3>Member Comments</h3>
    <ul>
        <li class="top-level">
            <ul class="comment-options right">
                <li>
                <a id="reply_1272195" class="reply" href="javascript:void(0);" name="anchor_1272195">Reply</a>
                </li>
                <li class="last">
                <a id="report_1272195" class="report" href="javascript:void(0);">Report Abuse</a>
                </li>
            </ul>
            <h6>Posted By: [CommentBy] @ [CommentDateEntered]</h6>
            <div class="post-content">
                <p>[CommentDesc]</p>
            </div>
        </li>
    </ul>
</div>  

I tried to do it with the following code but I keep getting errors.

$(document).ready(function(){
    $.ajax({
        dataType: "xml",
        url: "/FLPM/content/news/news.cs.asp?Process=ViewNews&NEWSID=<%=Request.QueryString("NEWSID")%>",
        success: function(xml) {
            $(xml).find('row').each(function(){
                var id = $(this).attr('id');
                var FullName = $(this).find('FullName').text();
                var CommentBy = $(this).find('CommentBy').text();
                var CommentDateEntered = $(this).find('CommentDateEntered').text();
                var CommentDesc = $(this).find('CommentDesc').text();
                $("#nw-comments ul").append("<h6>Posted By: " + CommentBy + " @ " + CommentDateEntered + "</h6><div class=""post-content""><p>" + CommentDesc + "</p></div>");

            });
        }
    });
  • 1 1 Answer
  • 1 View
  • 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-14T02:39:13+00:00Added an answer on May 14, 2026 at 2:39 am

    This part:

    $(xml).find('row').each(function(){
    

    Needs to be:

    $(xml).find('CommentID').each(function(){
    

    The direct child of your <Comments> element returned is <CommentID>, not <row> like it’s currently looking for.

    Also, you want to append to only the first <ul> so change this:

    $("#nw-comments ul")
    

    To this:

    $("#nw-comments > ul > li")
    

    Otherwise it’ll append to both <ul>‘s and you’ll get a duplicate of all comments in the wrong place.

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

Sidebar

Related Questions

Are these nested comments allowed in a XML file? <!-- Making only one observation
Here is a short XML file with 2 nodes having the same children (but
Is it OK to put comments before the XML declaration in an XML file?
I'm marshaling objects into an XML file. How can I add comments into that
I cant seem to get an XML file containing the comments in my C#
sorry if it's a silly question. Do comments in the java or xml file
I have an XML file that looks like this <comments> <text> <![CDATA[ <!--cached-Tue, 02
Is it possible to generate a set of wiki pages from XML comment file
XML File Sample <GateDocument> <GateDocumentFeatures> ... </GateDocumentFeatures> <TextWithNodes> <Node id=0/> MESSAGE SET <Node id=19/>
my xml file has a tag with an attribute containsValue which contains the special

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.