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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:33:47+00:00 2026-05-30T03:33:47+00:00

I have a div, and I’m reloading it with Ajax every 1 second. And

  • 0

I have a div, and I’m reloading it with Ajax every 1 second. And it has auto value as overflow. To keep my div always bottom, I’m using a javascript code in Ajax request.

xmlHttp.onreadystatechange=function(){
    document.getElementById('chatting').scrollTop = 9999999;
    if(xmlHttp.readyState==4){
        document.getElementById('chatting').innerHTML=xmlHttp.responseText;
        setTimeout('Ajax()',1000);
    }
}
var withdate=document.getElementById('firstdate').value;
nocache = Math.random();
xmlHttp.open("GET","db.getMessages.php?date=" + withdate + "&nocache = "+nocache,true);
xmlHttp.send(null);
}

window.onload=function(){
    setTimeout('Ajax()',1000);
}

But I can’t select texts and can’t go upper. When the new content is loaded, div slides bottom. How can I solve this?


I’ve a question too. I’m using a PHP file to define json contents. And output is like this:

{ "msg": [{"from":"demo","text":"test message "} ] }

But Firebug shows this error to me:

Error: JSON.parse: unexpected character
Source File: http://localhost/script/script/json.js
Line: 20

Line 20 is:

var msgs = JSON.parse(xhr.responseText);

I struggle so much but haven’t solve 🙁

  • 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-30T03:33:49+00:00Added an answer on May 30, 2026 at 3:33 am

    You replace the whole chatting-Element and expect the browser to remember and keep the selection?
    I guess you’re implementing a simple chat client, right? Then, why don’t you just pull new messages instead of, I guess, all? Return all messages as JSON and create DOM-nodes on your own which you append to the chatting-element. That approach allows you to select content as it never changes and keeps traffic down.

    btw:
    nocache-Parameters are usually done using a timestamp, because time is always increasing. A Math.random() is not guaranteed to be unique.

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

Sidebar

Related Questions

I have a div and an iframe on the page the div has z-index:
I have a div with overflow:hidden , inside which I show a phone number
I have div(box) on my page and I'm using this script to display div
I have div with 6 classes. I want to know if that div has
In the second table cell I have a div inside of it that I
How to change the id of the div using jquery? I have div with
I have div elements, containing images. I want to make the div resizeable using
I have DIV which has 2 backgrounds, in my case, it is gradient and
I have three divs with display: inline-block . In every div i have div
I have div, which has id 'content'. It's visible. <div id=wrapper style=display:block> <div id=content>

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.