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

  • Home
  • SEARCH
  • 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 9153675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:43+00:00 2026-06-17T12:18:43+00:00

I have a JSON like what you see below, that I want to keep

  • 0

I have a JSON like what you see below, that I want to “keep alive”. I would like to continually query the server (“refresh” at a continual interval, say 30 seconds) and update what’s displayed on the page accordingly. The JSON appears as so:

[
        {
            "Name": "Paul",
            "Date": "2012-10-26",
            "Score": 8
        },
        {
            "Name": "Janet",
            "Date": "2012-10-24",
            "Score": 18
        },
        {
            "Name": "Rick",
            "Date": "2012-10-26",
            "Score": 13
        }
]

My current (static) version to display this is:

<body>
<script>
$.getJSON('myjson.json', function(data) {
for (var i in data) {
var Name = data[i].Name;
var Score = data[i].Score;
}           
var output = "<ul>";
for (var i in data) {
output += "<li>" + Name + "--" + Score;
}
output += "</ul>";
document.getElementById("placeholder").innerHTML=output;
});
</script>
<div id="placeholder"></div>
</body>

This of course displays the data, but how would I “stream” the changes to “Score” as the json changes on the server (without refreshing the page)?

Is this what’s referred to as polling?

Any help is appreciated. Thank you

  • 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-17T12:18:44+00:00Added an answer on June 17, 2026 at 12:18 pm

    You just need to use a timer, or to be more specific, setInterval()…

    <script>
        function getData() {
            $.getJSON('myjson.json', function(data) {
                for (var i in data) {
                    var Name = data[i].Name;
                    var Score = data[i].Score;
                }           
                var output = "<ul>";
                for (var i in data) {
                    output += "<li>" + Name + "--" + Score;
                }
                output += "</ul>";
                document.getElementById("placeholder").innerHTML=output;
            });
        }
        setInterval(getData, 30000);
    
        $(function() {
            getData();
        });
    </script>
    

    The above script will run the getData() function at document.ready and then every 30 seconds, and update the #placeholder element with the return value.

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

Sidebar

Related Questions

I have a JSON-like data structure (which I don't want to change) that is
I have a JSON array like below: var jsonArray = [{k1:v1},{k2:v2},{k3:v3},{k4:v4},{k5:v5}] I don't know
I have a complex JSON object that I want represent as C# class. I
I have JSON like this: { something: http://something.com } and HTML like this: <a
i have json data like this {GetStudentDetails: {TotalCount:5, RootResults:[ {city:West Chester,country:USA,state:PA ,student_id:100}, {city:Philly,country:USA,state:PA,student_id:101}, {city:Buffalo,country:USA,state:NY,student_id:102},
I have a JSON like this { id:1, name:Jack, parent.id:2 } Note the dot
I am using json-simple . If I have a JSON like: [ {id:1,name:...,description:...,dtStart:2012-03-27 03:00:00,dtEnd:2012-03-28
I have a json string like this: { d: { results: [ { __metadata:
I have a json response like: { total: 2, success: true, rows: [ {a1_id:7847TK10,
I have a JSON data like this: { hello: { first:firstvalue, second:secondvalue }, hello2:

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.