Not.
The method jQuery.load()
, as well as the jQuery.get()
, is a simplification of jQuery.ajax()
.
What happens in the case of load()
is that the server response will be inserted into the element that is specified in the first parameter when the request is completed.
You can see in the source code of the function itself.
I only took the main part of the function (I removed the comments and formatted it to be easier to read).
jQuery.ajax({
url: url,
type: type || "GET",
dataType: "html",
data: params
}).done(function(responseText){
response = arguments;
self.html( selector ?
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
responseText );
}).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
});
});
See the full source on Github.
In the documentation, it is possible to see that the function receives three parameters:
url
: The URL to request;
data
: Object or string to send to the server in the request; and
complete
: Function of callback to be executed when the request is completed.
If you intend to use the beforeSend
better use jQuery.ajax()
.