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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:28:37+00:00 2026-05-27T11:28:37+00:00

The JQuery .load() definition follows: .load( url [, data] [, complete(responseText, textStatus, XMLHttpRequest)] );

  • 0

The JQuery .load() definition follows:

.load( url [, data] [, complete(responseText, textStatus, XMLHttpRequest)] );

The data and complete() arguments are optional. Right? But then, how we can call this:

$('#result').load('ajax/test.html', function(){
    alert('Load was performed.');
}

How jquery ignores the 2nd argument and knows that we provided the 1st and the 3d argument? And what if the 3d argument is not a function?

  • 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-27T11:28:37+00:00Added an answer on May 27, 2026 at 11:28 am

    If load is called with two arguments or more, jQuery checks to see if the second argument is a function or an object. If it’s a function it’s called when the ajax call is completed. Otherwise it’s used as the params passed with the ajax call.

    Relevant parts from the source:

    if ( params ) {
        // If it's a function
            if ( jQuery.isFunction( params ) ) {
            // We assume that it's the callback
            callback = params;
            params = null;
        // Otherwise, build a param string
        } else if ( typeof params === "object" ) {
            params = jQuery.param( params, jQuery.ajaxSettings.traditional );
            type = "POST";
        }
    }
    

    Where params is the second argument to load.

    isFunction is the result of the following functions:

    isFunction: function( obj ) {
        return jQuery.type(obj) === "function";
    },
    type: function( obj ) {
        return obj == null ?
            String( obj ) :
            class2type[ toString.call(obj) ] || "object";
    },
    

    where class2type is an assosiative array containing, among other things, this element:

    class2type[ "[object Function]" ] = "function";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery .load to call an action but it is not found.
We are using jquery to .load() a form into a div We then use
I'm using the jQuery .load() function to pull in data to populate a div
I would like everytime I call a jquery load function: $(#div).load(file.php); To then call
I use jQuery.load to load a localhost URL (eg: localhost/wp/contact) which it works fine,
I'm trying to use jquery load function, but I can't get the whole content
I'm using jQuery.load to load in some content but for SEO and for JavaScript-disabled
If I use Googles Jquery load script inlink, then if the user has the
I am using jQuery load, to load some data from an external file like
Does anyone know how to get the jQuery .load() function to work concurrently? Right

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.