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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:37:24+00:00 2026-06-13T23:37:24+00:00

I am trying to do 2 ajax function calls when a user clicks a

  • 0

I am trying to do 2 ajax function calls when a user clicks a button.

I have

$('.test').on('click', function(){

    code.getCode();
        code.getText();
})

code.prototype.getCode=function(){
     var call=//call ajax
     call.callback= function(data){
          //parse return data
    }
}


code.prototype.getText=function(){
     var call=//call ajax
     call.callback= function(data){
          //parse return data
    }
}

I can only do 1 ajax call and only 1 ajax call will return data.
I am not sure how to solve this. Any ideas? Thanks a lot!

  • 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-13T23:37:25+00:00Added an answer on June 13, 2026 at 11:37 pm

    I am not sure if I understood correctly, but I think you are looking for a single callback from both the ajax calls..

    You should use $.when.done. See below,

    $.when($.ajax("/page1.php"), $.ajax("/page2.php")).done(function(a1,  a2){
        /* a1 and a2 are arguments resolved for the 
            page1 and page2 ajax requests, respectively */
       var jqXHR = a1[2]; /* arguments are [ "success", statusText, jqXHR ] */
       if ( /Whip It/.test(jqXHR.responseText) ) {
          alert("First page has 'Whip It' somewhere.");
       }
    });
    

    Not sure if you looking for sequencing it or trying to have 1 callback.

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

Sidebar

Related Questions

I have a div that is created by Ajax with .append(html) function, I'm trying
I have a page in MVC3, with a link (Ajax.ActionLink). When user clicks it,
I am trying to do the following: function main(callback) { $.ajax('server-side', function() { this.callback.call(hello);
I am trying to do a simple AJAX function to send data from query
I'm trying to return data as an array to my .ajax function on success
I'm trying to get an jquery ajax callback function to update the background colour
I'm trying to return the ajax success array from one function to another. For
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:GET,
I'm trying to set a function that makes an Ajax call, but I must

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.