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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:32:07+00:00 2026-06-08T03:32:07+00:00

What I need to do is prepend the users latest status update with not

  • 0

What I need to do is prepend the users latest status update with not only the newmsg and the users id but I need to also add my comment toggle link, my divider-postid div my users picture and name, my delete button, and my like and dislike button. So what I’d have is something like what Twitter and facebook do. ->Send the form data into ajax and print everything out into the feed. My profile.php has everything I use that needs to be included.

So is there a way I can call these blocks of html and display them in the prepended div after the Ajax success? Its really hard to explain as I don’t know what I’m doing, but hopefully you get the idea. I’m just not up on all this.

PROFILE.PHP

   $(document).ready(function(){
    $("form#myform").submit(function(event) {
    event.preventDefault();
    var content = $("#toid").val();
    var newmsg = $("#newmsg").val();
    $.ajax({
    type: "POST",
    cache: false,
    url: "insert.php",
    data: "toid=" + content + "&newmsg=" + newmsg, 
    success: function(){
    $("#myThing").prepend("<div class='userinfo'>"+newmsg+" </div>");
    }
    });
    });
    });
    </script>
    <div class="userinfo"><div id="divider">
    <div class="form">
    <form id="myform"  method="POST"  class="form_statusinput">
    <input type="hidden"  name="toid" id="toid" value="<?php echo $user1_id; ?>">
    <input class="input" name="newmsg" id="newmsg" placeholder="Say something" autocomplete="off">
    <div id="button_block">
    <input type="submit" id="button" value="Feed">
    </div>
    </form>
    </div></div></div></body>
    <p id="myThing"></p>



  COMMENT LINK

echo "<div class='stream_option'><a style='cursor:pointer;' id='commenttoggle_".$streamitem_data['streamitem_id']."' onclick=\"toggle_comments('comment_holder_".$streamitem_data['streamitem_id']."');clearTimeout(streamloop);swapcommentlabel(this.id);\"> Write a comment...</a></div>";
}else{
echo "<div class='stream_option'><a style='cursor:pointer;' id='commenttoggle_".$streamitem_data['streamitem_id']."' onclick=\"toggle_comments('comment_holder_".$streamitem_data['streamitem_id']."');clearTimeout(streamloop);swapcommentlabel(this.id);\"> Show Comments (".$num2.")</a></div>";

LIKE LINK

cho "<div class='stream_option'><a id='likecontext_".$streamitem_data['streamitem_id']."' style='cursor:pointer;' onClick=\"likestatus(".$streamitem_data['streamitem_id'].",this.id);\">";

DISLIKE LINK

echo "<div class='stream_option'><a id='dislikecontext_".$streamitem_data['streamitem_id']."' style='cursor:pointer;' onClick=\"dislikestatus(".$streamitem_data['streamitem_id'].",this.id);\">";

DELETE LINK

<? if($streamitem_data['streamitem_creator']==$_SESSION['id']){
echo "<div style='cursor:pointer;position:relative;top:-70px;float:right;padding-right:5px;' onclick=\"delete_('".$streamitem_data['streamitem_id']."');\">X</div>";}   
  • 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-08T03:32:09+00:00Added an answer on June 8, 2026 at 3:32 am

    I guess here:

    success: function(){
      $("#myThing").prepend("<div class='userinfo'>"+newmsg+" </div>");
    }
    

    Is where you’re inserting the HTML? If that’s the case, and if insert.php returns HTML, try this:

    success: function(r){
      $("#myThing").prepend("<div class='userinfo'>"+newmsg+r.responseText+" </div>");
    }
    

    To get the ID:
    I guess the insertion is done with mysql, so after the new message is inserted you’d do:

    $new_id = mysql_insert_id();
    

    and then output the HTML:

    echo "<div class='stream_option'><a id='likecontext_".$new_id."' style='cursor:pointer;' onClick=\"likestatus(".$new_id.",this.id);\">";
    
    echo "<div class='stream_option'><a id='dislikecontext_".$new_id."' style='cursor:pointer;' onClick=\"dislikestatus(".$new_id.",this.id);\">";
    
    if ($new_id == $_SESSION['id'])
      echo "<div style='cursor:pointer;position:relative;top:-70px;float:right;padding-right:5px;' onclick=\"delete_('".$new_id."');\">X</div>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating XML using a while loop, but now I need to prepend
I have a user supplied text and I need to prepend all backslashes and
I need to prepend a huge DIV block, which can be seen at the
For a website i am developing in django i need users to be able
I need help with writing a regular expression in PHP. I am not friend
I need to add to a QByteArray 4 bytes, as frame. (struct ([4 bytes][message]))
I'm trying to prepend a string a read-only, multi-line TextBox using the following code:
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
Need a map reduce function by mongo in php This my mongo structure [_id]
Need some regular expressions help. So far I have my code working to allow

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.