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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:20:25+00:00 2026-06-06T16:20:25+00:00

Right, I solved my previous problem of not being able to submit the textarea

  • 0

Right, I solved my previous problem of not being able to submit the textarea on the return key but that presented a new one. It submits the comment via ajax, and then loads it fine, on the first status. No matter which post I try and add the comment to, it appends the comment to the first status div on the page, not the one which the action is being carried out on. However, if I refresh the page, the comments appear on the right status, so I know the right ID’s are being submitted, it’s just being appended in the wrong place, but I can’t see why.

My submit code:

$(function() {  
    $('textarea#scat').bind('keydown', function(e) {
        if(e.keyCode==13){
            var myClass = $(this).attr("class");  
            var comment = $("textarea." + myClass).val();  
            if (comment == "") {  
                return false;  
            }

            if (!$.trim($("textarea." + myClass).val())) {  
                return false;  
            }

            var cid = $("input.c_" + myClass).val();  
            var itemid = $("input.i_" + myClass).val();  
            var type = $("input.t_" + myClass).val();  
            var top = $("input.l_" + myClass).val();  

            var dataString = 'comment='+ comment + '&cid=' + cid + '&itemid=' + itemid + '&type=' + type;  

            $.ajax({  
                type: "POST",  
                url: "addcomment.php",  
                data: dataString,  
                success: function() {  
                    $('#c').load('ajax/querylc.php?oid=' + myClass); 
                    $("textarea." + myClass).val('');
                }  
            });  
        return false;  
        }
    });  
});  

My ajax/querylc.php (which loads the comment and appends it to said status)

$onuid = strip_tags(stripslashes(htmlentities(mysql_real_escape_string($_GET['oid']))));

  $re = ("SELECT * FROM (SELECT comment as comment, byuid as byuid, comuid as comuid, likes as likes, dislikes as dislikes, UNIX_TIMESTAMP(timestamp) as timestamp FROM mingle_comments WHERE onuid = '$onuid' AND type = 'status' ORDER BY timestamp DESC LIMIT 2) mingle_comments ORDER BY timestamp ASC") ; //query
   $result = mysql_query($re)  or die (mysql_error());
  if(mysql_num_rows($result) >= 2) {
        ?>
        <div id="sa" style="background:#E0E0E0; padding:5px 5px 5px 5px;">
            <a href="#" style="font-family:Arial; font-size:12px; color:#3a3a3a; text-decoration:none;">View all comments...</a>
        </div>
        <?php
    }

  while($st = mysql_fetch_assoc($result)) {
    $comment = $st['comment'];
    $by = $st['byuid'];
    $comuid = $st['comuid'];
    $time = $st['timestamp'];
    $l = $st['likes'];
    $d = $st['dislikes'];

    $bq = "SELECT * FROM users WHERE uid = '$by' LIMIT 1";
    $bqq = mysql_query($bq) or die (mysql_error());

    while($bqr = mysql_fetch_assoc($bqq)) {
        $dp = $bqr['dp'];
        $fbq = $bqr['fname'];
        $sbq = $bqr['sname'];
    }
    ?>

    <div id="commentbox" class="<?php echo $comuid; ?>" style="padding:5px 5px 5px 5px;">
        <div id="cbi" style=" display:inline; position:relative; ">
            <img src="<?php if ($dp == null) { echo 'img/unknown_user.jpg'; } else { echo "pf/" . $by . "/" . $dp; } ?>" width="36px" style=" display:inline; position:relative;"/>
        </div>
        <div id="cbt" style="position:relative; margin-left:32px; margin-top:-35px;">
            <a href="profile.php?uid=<?php echo $uid; ?>" style="position:relative; font-size:13px; margin-left:10px; font-family:Arial; color:#3a3a3a; text-decoration:none;"><?php echo $fbq . " " . $sbq; ?></a>
            <p class="<?php echo $comuid; ?>" style="position:relative; margin-left:5px;"><?php echo $comment; ?></p>
        </div>
        <div id="clb" style="background:#E0E0E0; padding-left:5px;">
            <a href="#">Like</a> <a href="#">Dislike</a> <a href="#" id="time"><?php echo time_since($time); ?></a>
        </div>
    </div>

<?php
}
?>

Any ideas why this is happening? :/ Also, if I hold the return key down it submits it multiple times, any ideas how I could prevent that?

  • 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-06T16:20:27+00:00Added an answer on June 6, 2026 at 4:20 pm

    Also, if I hold the return key down it submits it multiple times, any
    ideas how I could prevent that?

    Use keypress event instead of keydown

    $('#c').load('ajax/querylc.php?oid=' + myClass); 
    

    ‘#c’ selector selects the first element with id “c”. So try to generate this id as unique one (“#c1”, “#c2”, etc).

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

Sidebar

Related Questions

This is a question following my previous problem, you can find it right there
I want to read excel display value, not value that excel internally saves. Problem
Clearly I must not be doing something right but this happens on random occasions.
THE PROBLEM IS SOLVED: I specified right: 0px instead of top: 0px ... I
EDIT: Problem Solved! For others, To fix it, simply right click the WebView, click
SOLVED: Crap... why is it always you figure something out right AFTER you finally
Right now I have some troubles. I'm finding a way to solve one problem.
I am having an xslt issue that I cannot seem to solve. Right now
Right now I have a script that will get the last five files in
Although it is looking similar to my previous post but here purpose is different.

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.