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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:01:12+00:00 2026-06-02T11:01:12+00:00

I need to retrieve JSON data from a URL periodically, and update my page

  • 0

I need to retrieve JSON data from a URL periodically, and update my page accordingly.

I have a table. Each row has a link that I would link to test its status say, every 20 seconds.

This could be achieved using a page refresh meta tag, but I think ajax would be a much nicer solution.

Should I be using $.getJSON? (im pretty new to ajax/json)

  • 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-02T11:01:17+00:00Added an answer on June 2, 2026 at 11:01 am

    You’re basically there. First of all, $.getJSON() is just a convenience method to $.ajax() where the datatype: 'json', and it’s a best practice to always stick with $.ajax(). You want to call setTimeout within the function that you want to asynchronously load – so you’ll be using recursion here. The benefit is that you can repeatedly make your AJAX call, but only when the previous method is completed, so everything operates correctly. A quick example of this would be something like the following:

    $(function() {
        var myFunction = function() {
            $.ajax({ 
                url: '/place-for-cool-stuff', 
                datatype: 'json',
                data: { ... data you need to send, e.g. method arguments ... }
             }).done(function (data) {
                 ... do stuff with the data you get back ...
             }).fail(function (jqXHR) {
                 ... be smart and handle failures ...
             }).always(function () {
                 ... no matter what happens do this stuff ...
                 setTimeout(myFunction, 20000);
             });
         };
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have MySQL database server I need to update and retrieve data to/from MySQL
I have a webservice url that retrieve a JSON as response.I need to send
I need to retrieve data from two tables. the first is a list of
I need to retrieve a simple page and use the data that it returns.
I am having trouble getting some data from a JSON object which I have
I'm using jQuery's $.getJSON() API to retrieve data from a given URL for a
I need to get rather complicate JSON data from (large) JSON file into a
I have a webpage that uses JavaScript to retrieve JSON from a web service.
I use jquery-ui plugin and I need to load data from a remote url.
I have an HTML form that builds a drop-down from json data that is

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.