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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:35:40+00:00 2026-05-24T19:35:40+00:00

I have two jQuery Ajax calls that I’m combining on a page. I’m stuck

  • 0

I have two jQuery Ajax calls that I’m combining on a page. I’m stuck on the success: function() in each, as one is success: function(msg) and the other is success: function(data). I’m unsure of what both of these mean, and what they should be in the combined code. I’ll place the two calls below, separately, and combined as I have them thus far.

Ajax Request #1: there is a $msg .= "<div class='pagination'><ul>"; on this functions php page. Not sure if that is what this is referring to.

$.ajax
({
    type: "GET",
    url: "new_arrivals_data.php",
    data: "page="+page,
    success: function(msg)
    {
        $("#gallery_container").ajaxComplete(function(event, request, settings)
        {
            gallery_show();
            loading_hide();
            $("#gallery_container").html(msg);
        });
    }
});

Ajax Request #2: As far as I can see, there is no data anywhere on this call’s php file. Don’t know what function(data) is referring to.

$.get("new_arrivals_data.php",{imgs: value}, function(data){
    $("#gallery_container").html(data);
});

Combined Request: I have put a ? where msg was in the original call as I’m unsure what to put in it’s spot.

$.ajax
({
    type: "GET",
    url: "new_arrivals_data.php",
    data: {page:page, imgs: value},
    success: function(?)
    {
        $("#gallery_container").ajaxComplete(function(event, request, settings)
        {
            gallery_show();
            loading_hide();
            $("#gallery_container").html(?);
        });
    }
});
  • 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-24T19:35:41+00:00Added an answer on May 24, 2026 at 7:35 pm

    msg and data are simply the names of the formal parameters. You use those to refer to the response data that is passed to that function when it is invoked.

    You can rename it to any valid JavaScript identifier.

    Although there isn’t really any reason to call ajaxComplete inside the success: callback:

    success: function( whatever_you_want_to_call_it ) {
            gallery_show();
            loading_hide();
            $("#gallery_container").html( whatever_you_want_to_call_it );
    }
    

    $.get("new_arrivals_data.php",{imgs: value}, function( i_like_ice_cream ){
        $("#gallery_container").html( i_like_ice_cream );
    });
    

    Remember, in both cases, you’re passing a function as an argument. That function is invoked when the response is received.

    Whatever code is invoking that function, is also passing the response into that function as the first argument so that you have access to it. That’s why you defined the parameter.

    It’s very similar to declaring a variable in a function.

    $.get("new_arrivals_data.php",{imgs: value}, function(){
    
        var i_like_ice_cream = arguments[0];
        $("#gallery_container").html( i_like_ice_cream );
    
    });
    

    This does almost the same thing. You’ve associated a variable with the first argument passed into your callback function.

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

Sidebar

Related Questions

I have two scripts running on the same page, one is the jQuery.hSlides.js script
my issue is that i have two ajax calls to php for a registration
I have an jquery ajax request that calls a PHP script that will send
I have two jquery ui datepickers in my page and I would like to
So I have two jquery functions that bassically do the same, but on 2
On my website I have two jQuery UI dialogs. One dialog just shows gif
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
I'm using the jQuery Validation JS I have two contact forms, the main one
I have two ajax functions that fetch JSON objects using .getJSON and then build
I have Page A which calls Page B using AJAX. Page B will be

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.