X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=inline;f=src%2Fajax%2Fajax.js;h=ffe30481d37e956024115124454c52801b82f9eb;hb=f96bf1041553775a94c1034c97e253e350217173;hp=9c9a5df3646d7f53e8d8430dc522d39144ae91c1;hpb=bfe5f891068af9f86d7be288ad0da7b442427d9c;p=jquery.git
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 9c9a5df..ffe3048 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -1,52 +1,14 @@
jQuery.fn.extend({
-
- /**
- * Load HTML from a remote file and inject it into the DOM, only if it's
- * been modified by the server.
- *
- * @example $("#feeds").loadIfModified("feeds.html");
- * @before
- * @result 45 feeds found.
- *
- * @name loadIfModified
- * @type jQuery
- * @param String url The URL of the HTML file to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded (parameters: responseText, status and response itself).
- * @cat Ajax
- */
- loadIfModified: function( url, params, callback ) {
- this.load( url, params, callback, 1 );
- },
-
- /**
- * Load HTML from a remote file and inject it into the DOM.
- *
- * Note: Avoid to use this to load scripts, instead use $.getScript.
- * IE strips script tags when there aren't any other characters in front of it.
- *
- * @example $("#feeds").load("feeds.html");
- * @before
- * @result 45 feeds found.
- *
- * @example $("#feeds").load("feeds.html",
- * {limit: 25},
- * function() { alert("The last 25 entries in the feed have been loaded"); }
- * );
- * @desc Same as above, but with an additional parameter
- * and a callback that is executed when the data was loaded.
- *
- * @name load
- * @type jQuery
- * @param String url The URL of the HTML file to load.
- * @param Object params (optional) A set of key/value pairs that will be sent as data to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded (parameters: responseText, status and response itself).
- * @cat Ajax
- */
- load: function( url, params, callback, ifModified ) {
+ load: function( url, params, callback ) {
if ( jQuery.isFunction( url ) )
return this.bind("load", url);
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
callback = callback || function(){};
// Default to a GET request
@@ -73,207 +35,65 @@ jQuery.fn.extend({
url: url,
type: type,
data: params,
- ifModified: ifModified,
complete: function(res, status){
- if ( status == "success" || !ifModified && status == "notmodified" )
- // Inject the HTML into all the matched elements
- self.attr("innerHTML", res.responseText)
- // Execute all the scripts inside of the newly-injected HTML
- .evalScripts()
- // Execute callback
- .each( callback, [res.responseText, status, res] );
- else
- callback.apply( self, [res.responseText, status, res] );
+ // If successful, inject the HTML into all the matched elements
+ if ( status == "success" || status == "notmodified" )
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(/