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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:08:34+00:00 2026-05-26T07:08:34+00:00

i want to write a greasemonkey script that reloads every 10 sec. the same

  • 0

i want to write a greasemonkey script that reloads every 10 sec. the same div of the same page. But i only know how to load a complete page into a div 🙁
of course my script below does’nt work…

function Ajax(){
var xmlHttp;
    try{    
        xmlHttp=new XMLHttpRequest();
    }catch (e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e){
                alert("No AJAX!?");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange=function(){
        document.getElementById('ReloadDIV').innerHTML=xmlHttp.responseText;
        setTimeout('Ajax()',10000);
    }
    xmlHttp.open("GET","#ReloadDIV",true);
    xmlHttp.send(null); 
}
window.onload=function(){
    setTimeout('Ajax()',10000);
}


<div id="ReloadDIV">Text Text</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-05-26T07:08:35+00:00Added an answer on May 26, 2026 at 7:08 am

    I think one problem is the onreadystatechage which should be:

    xmlHttp.onreadystatechange=function(){
    if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
        document.getElementById('ReloadDIV').innerHTML=xmlHttp.responseText;
        setTimeout('Ajax()',10000);
        }
        }
    

    readyState = 4 means request is finished and response is ready and the status = 200 is an OK response from the server

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

Sidebar

Related Questions

I want to write a greasemonkey script/chrome user script that takes any images with
I want to write some JavaScript that will change the onmousedown of a div
I want to write a jQuery function that will return only a part of
I want to write a Greasemonkey script to detect when a YouTube video on
I want to write a greasemonkey script to scrape sites and save data locally,
I am trying to write a GreaseMonkey script in which I want to find
I have whole page HTML in my database and i want write that html
i want write a mapping File for following Class, but i dont know how.
I would like to write a greasemonkey script that given an xpath returns all
I don't know greasemonkey but I think it is a way to script or

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.