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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:25:11+00:00 2026-05-17T21:25:11+00:00

The first time a user is visiting my website, I am pulling a lot

  • 0

The first time a user is visiting my website, I am pulling a lot of information from various sources using a couple of ajax calls. How do I reload the page once the ajax calls are done?

if(userVisit != 1) {
  // First time visitor
  populateData();
}

function populateData() {
  $.ajax({
            url: "server.php",
            data: "action=prepare&myid=" + id,
            dataType: "json",
            success: function(json) {
                if(json.error) { 
                    return;
                }
                _id = response[json].id;
                getInformation(_id);
            }
  });
}

function getInformation(id) {
  $.ajax({
            url: "REMOTESERVICE",
            data: "action=get&id=" + id,
            dataType: "json",
            success: function(json) {
                if(json.error) { 
                    return;
                }

                $.ajax({
                       url: "server.php",
                       data: "action=update&myid=" + id + '&data=' + json.data.toString(),
                       dataType: "json",
                       success: function(json) {
                                if(json.error) { 
                                    return;
                                }
                      }
                });
            }
  });
}

So what the code does is, it gets a list of predefined identifiers for a new user (populateData function) and uses them to get more information from a thirdparty service (getInformation function). This getInformation function queries a third party server and once the server returns some data, it sends that data to my server through another ajax call. Now what I need is a way to figure out when all the ajax calls have been completed so that I can reload the page. Any suggestions?

  • 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-17T21:25:12+00:00Added an answer on May 17, 2026 at 9:25 pm

    In your getInformation() call you can call location.reload() in your success callback, like this:

    success: function(json) {
      if(!json.error) location.reload(true);
    }
    

    To wait until any further ajax calls complete, you can use the ajaxStop event, like this:

    success: function(json) {
      if(json.error) return;
      //fire off other ajax calls
      $(document).ajaxStop(function() { location.reload(true); });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time SO user :) I know that I can format a number like
I'm looking to implement user login onto my site for the first time. I'm
I'm working with caching and persistence for the first time. I have a user
The first time I load the website in the production web server, it start
This is my first time attempting to call an ASP.NET page method from jQuery.
This is my first time using joomla. I don't know if I'm using the
First time user of stackoverflow, but I have followed its development over on Coding
Here's my two scenarios. 1 - User opens app for the first time ever
The first time I try to open a particular form many of the controls
Long time listener, first time caller. I'm a full time SE during the day

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.