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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:10:50+00:00 2026-05-30T10:10:50+00:00

i am updating content with ajax call from server. after the update, i empty

  • 0

i am updating content with ajax call from server.
after the update, i empty the wrapper div, that contains the data, and fill it again with the new data.
so far so good.
the problem is – that on a

$('#MessagesContainer').empty();

method – the scrollbar changes back up.
so if someione want to add data and he is in the bottom of the page, the scroll goes back up.

this action makes sense, but for this particular action i want to avoid it since it’s not so “user-friendly”.

  • 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-30T10:10:51+00:00Added an answer on May 30, 2026 at 10:10 am

    well, thanks for your answers.
    use .html() would probably be better than .empty() and re-append the data.
    but, the thing is that for my implementation that is not possible.

    so what i did is implemented

    .RemoveAfter(x) function
    

    that remove all the elements after index ‘x’ in the collection and then append data from this ‘x’ index. that did the trick. the scrollbar stays where it is. it’s not 100% percent user-friendly since it make some of the data disappear for a milisecond and then it comes back, but at this currently point, it’s the best i could think of.

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

Sidebar

Related Questions

I'm updating the page title after some content is refreshed using AJAX, but the
After updating to Parsec 3.1 from 2.x, code using many1, such as word =
What I want to do is that: a webpage with continuously updating content. (In
When I am making an ajax call the controller is redirecting and not updating
I want to use the Ajax.BeginForm, without updating any element, only call the callback
I'm trying to callback into my ViewResult Index() controller action from an ajax call
I have an Ajax.ActionLink that successfully calls my controller action but instead of updating
After updating or creating a record I use url helper to redirect to the
After updating to php 5.3 one of our systems has developed an interesting bug.
I am updating a selectlist element using a jquery ajax callback in a mvc

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.