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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:53:08+00:00 2026-06-12T11:53:08+00:00

I have a webpage where I have 3 separate ajax calls All 3 use

  • 0

I have a webpage where I have 3 separate ajax calls

All 3 use the same structure:
$.ajax({
//this is the php file that processes the data and send mail
url: url,

        //POST method is used
        type: "POST",

        //pass the data         
        data: data,     

        //Do not cache the page
        cache: false,

        //success
        success: function (json) {              

I want to trigger another function but only if the 3 separate ajax calls are successful.

How do I go about doing that?

Update:
I now have an issue when using $.when()

My code now looks like this:

function mainFunction() {
    $.when(someAjaxCall()).done(function(ajaxResult){
            // after all the pages, covers, and sneaks are uploaded
            // we will now change the status
            //start the ajax
            console.log(ajaxResult);
}

function someAjaxCall() {
    // do something...
    if (someGlobalScopedVariable == true) {
         return $.ajax({
        //this is the php file that processes the data and send mail
        url: url,

        //POST method is used
        type: "POST",

        //pass the data         
        data: data,     

        //Do not cache the page
        cache: false,

        //success
        success: function (json) {....},
     });
    }
}

The ajaxResult inside the mainFunction $.when gives me undefined.
Did I do something wrong because i followed this http://api.jquery.com/jQuery.when/

  • 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-12T11:53:09+00:00Added an answer on June 12, 2026 at 11:53 am

    Use jQuery.when.

    var deferred1 = $.ajax({ ... });
    var deferred2 = $.ajax({ ... });
    var deferred3 = $.ajax({ ... });
    
    $.when(deferred1, deferred2, deferred3).then(
        function(info1, info2, info3) {
            var response1 = info1[0], response2 = info2[0], response3 = info3[0];
            // Do something with response 1, 2, and 3...
        }
    );
    

    $.ajax returns a Deferred object. You can pass several Deferred objects to $.when in order to wait for all of them to complete.

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

Sidebar

Related Questions

I have a webpage that retrieves data (via ajax/php) and shows it in an
I have a webpage that redirects to another webpage like this: http://www.myOtherServer.com/Sponsor.php?RedirectPage=http://mylink.com/whereIwasgoingtogo.html Then the
I have a webpage that displays a very large list of data. Since this
I have a webpage that is transferring A stylesheet as a text/plain MIME type.
I have a webpage that when landed on, will detect a user's physical location
I have a webpage, on which I am using Ajax to replace different divs
I have this thing on my webpage... I guess it could be called a
I have a txt file which actually is a html source of some webpage.
I use jQuery ajax calls to ASP.Net web services (ASMX files) to update the
I have a PHP based web page. Using Ajax, I call PHP routines. 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.