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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:46:12+00:00 2026-05-16T23:46:12+00:00

Hi so at success on my ajax call, it prepends the response: $(#nowCurrentComment +

  • 0

Hi so at success on my ajax call, it prepends the response:

 $("#nowCurrentComment" + bID).prepend(msg); 

Now, if you use the form that executes the ajax call more than once, then the first time that is prepended doesnt remove, but it just add the new prepended msg besides it..

I want to fadeout the old if exist and fadein the new. Is it possible?

So i dont it get like this:

When i pressed the submit button once:

Comment1

when i pressed twice:

Comment1Comment1
  • 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-16T23:46:13+00:00Added an answer on May 16, 2026 at 11:46 pm

    Sure, just don’t prepend the content. Switch a sub-element instead.

    So if your DOM was…

    <div id="nowCurrentComment123">
      <span class="message"></span>
    </div>
    

    Then your script would be…

    var $msg = $("#nowCurrentComment123").find('.message');
    // if it already has a message, fade it out, add the text, then fade it back in
    if ( $msg.text().length ) {
      $msg.fadeOut('fast', function(){
        $msg.text( msg ).fadeIn('fast');
      });
    } else {
      // otherwise just hide it, add the text, and then fade it in
      $msg.hide().text( msg ).fadeIn('fast');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an $.ajax call that includes both a success and error condition: $('input[name=StateName]').live('change',
I want to display a success msg after finishing an Ajax call. I tried
I have a jquery json ajax call and inside my success function I have
Let's say on ajax success the function: xmlParser(xml) is called and the XML response
It seems that i cannot access $(this) inside jquery ajax success function. please see
I'm trying to create a global handler that gets called before the ajax success
I have a jquery ajax call that goes to the create action, and I
I'm trying to get the success data from a jquery Ajax call so I
I am using JQuery to perform form submission through an ajax request. I use
I have to call a function only if ajax call success . Code: <script>

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.