]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/jquery/src/ajax/load.js
bff25b1a4043bb9e0279345aace2b95adab1708c
8 // Optional event/alias dependency
10 ], function( jQuery
) {
12 // Keep a copy of the old load method
13 var _load
= jQuery
.fn
.load
;
16 * Load a url into a page
18 jQuery
.fn
.load = function( url
, params
, callback
) {
19 if ( typeof url
!== "string" && _load
) {
20 return _load
.apply( this, arguments
);
23 var selector
, type
, response
,
25 off
= url
.indexOf(" ");
28 selector
= jQuery
.trim( url
.slice( off
) );
29 url
= url
.slice( 0, off
);
33 if ( jQuery
.isFunction( params
) ) {
35 // We assume that it's the callback
39 // Otherwise, build a param string
40 } else if ( params
&& typeof params
=== "object" ) {
44 // If we have elements to modify, make the request
45 if ( self
.length
> 0 ) {
49 // if "type" variable is undefined, then "GET" method will be used
53 }).done(function( responseText
) {
55 // Save response for use in complete callback
60 // If a selector was specified, locate the right elements in a dummy div
61 // Exclude scripts to avoid IE 'Permission Denied' errors
62 jQuery("<div>").append( jQuery
.parseHTML( responseText
) ).find( selector
) :
64 // Otherwise use the full result
67 }).complete( callback
&& function( jqXHR
, status
) {
68 self
.each( callback
, response
|| [ jqXHR
.responseText
, status
, jqXHR
] );