diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
commit | 3ce894af1e72c9488b8cb3340fd61656122f7d50 (patch) | |
tree | a603121e8b1e860201370399f8095121cd9c6bf7 /js/vendor/jquery/src/ajax/load.js | |
parent | 10d76fff64363ea59d916b550854cf3540dadfbc (diff) |
use markdown, refactor js
Diffstat (limited to 'js/vendor/jquery/src/ajax/load.js')
-rw-r--r-- | js/vendor/jquery/src/ajax/load.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/js/vendor/jquery/src/ajax/load.js b/js/vendor/jquery/src/ajax/load.js deleted file mode 100644 index 3c345a027..000000000 --- a/js/vendor/jquery/src/ajax/load.js +++ /dev/null @@ -1,75 +0,0 @@ -define([ - "../core", - "../core/parseHTML", - "../ajax", - "../traversing", - "../manipulation", - "../selector", - // Optional event/alias dependency - "../event/alias" -], function( jQuery ) { - -// Keep a copy of the old load method -var _load = jQuery.fn.load; - -/** - * Load a url into a page - */ -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - var selector, type, response, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // If we have elements to modify, make the request - if ( self.length > 0 ) { - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - self.html( selector ? - - // If a selector was specified, locate the right elements in a dummy div - // Exclude scripts to avoid IE 'Permission Denied' errors - jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : - - // Otherwise use the full result - responseText ); - - }).complete( callback && function( jqXHR, status ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - }); - } - - return this; -}; - -}); |