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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:23:42+00:00 2026-05-27T20:23:42+00:00

Im trying to make something like this http://demos.99points.info/facebook_wallpost_system/ which is a comment system. I

  • 0

Im trying to make something like this http://demos.99points.info/facebook_wallpost_system/ which is a comment system. I have the ajax code below except i don’t know how to uniqely select textareas. The challenge is that the number of posts is variable so all of the posts need to be uniquely identified so that when the data is put into the database i know which post it relates to.

JQUERY:

<script type='text/javascript'>
$('document').ready(function(){

$('.commentContainer').load('../writecomment.php');
        //commentContainer is a class so it applies to all of the textareas, but i need this selector to be unique

$('.submitCommentBox').click(function(){

            //these are the selectors that i can't get to work right
    var comment = $('').val();
    var postid = $('').val();


    $.post('../comment.php',
    {

    comment: comment,
    postid: postid,



    },
    function(response){

        $('#commentContainer').load('../writecomment.php');
        $('.commentBox').val('');

    }

    }

    return false;

}):

});

</script>

HTML/PHP

<?php while ($row=mysql_fetch_assoc($query)){

echo"
<p name='singlePost'>$post[$f]</p>
<div id='commentContainer'></div>
<textarea class='commentBox'></textarea>
<input type='button' value='submit' class='submitCommentBox'>";
 }

basically the HTML/PHP generates for each post on the page as to create a textarea and subimt button for each post. therefore the user can comment on each post.

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

    Using the markup in the link you provided, I would do something like:

    var container  = $(this).closest('.friends_area');
    
    var comment    = $(container).find('.commentbox').val();
    var questionid = $(container).find('#hidden').val();
    var answerid   = $(container).find('').val();
    

    A more correct solution would be something like:

    HTML

    <div id="posting">
        <form method="post" action="">
            <input type="hidden" name="record_id" value="123" />
            <textarea name="comment"></textarea>
            <button type="submit">Comment</button>
        </form>
    
        ...
    </div>
    

    JS

    $('#posting').on('submit', 'form', function(e) {
    
        e.preventDefault();
    
        var form = $(this).closest('form');
    
        $.post($(form).attr('action'), $(form).serialize(), function() {
            $('#commentContainer').load('../writecomment.php');
            $('.commentBox').val('');
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically what I'm trying to do is make something like this: http://store.kapit.biz/demo/treemap/prod/index.html# I've
I am trying to make something like this site has: http://www.eventipity.com/ When you press
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
I am trying to make terrain mesh, and for now got something like this:
I have a list of topic categories that looks something like this mockup: http://www.problemio.com/problems/categories.php
I've tried almost all the possible permutations... I'm trying to make something like this:
I am trying to make a table to display something like this: ________ |__|__|__|
I'm trying to create a user control that allows users to make something like
I have something like this and it has been created from jQuery .append(html) <div

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.