No.
The jQuery.load()
method, as well as jQuery.get()
, is a simplification of > jQuery.ajax()
.
What happens in the case of load()
is that the server response will be inserted inside the element that is specified in the first parameter when the request is terminated.
You can see it in the source code of the function itself.
I just took the main part of the function (I removed the comments and formatted to make it 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 ] );
});
});
View the full source on GitHub.
In documentation , you can see that the function receives three parameters:
-
url
: The URL to make the request;
-
data
: Object or string to send to the server in the request; and
-
complete
: callback function to run when the request is complete.
If you want to use beforeSend
it's best to use jQuery.ajax()
.