X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=ccf4f14a95f89048b842a048b5b5984a8433e95b;hb=456f0fe5985eaad42eba456b9ff710771669607c;hp=4b1e9b0e2314303e3cb4857f36b6c5dd3182fa5f;hpb=f83211c684b0a1031001c448ff7a4cfbac8c1c1f;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index 4b1e9b0..ccf4f14 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -15,6 +15,7 @@ jQuery.fn.extend({ * @param Function callback (optional) A function to be executed whenever the data is loaded (parameters: responseText, status and response itself). * @cat Ajax */ + // DEPRECATED loadIfModified: function( url, params, callback ) { this.load( url, params, callback, 1 ); }, @@ -47,6 +48,12 @@ jQuery.fn.extend({ 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 @@ -77,9 +84,24 @@ jQuery.fn.extend({ complete: function(res, status){ // If successful, inject the HTML into all the matched elements if ( status == "success" || !ifModified && status == "notmodified" ) - self.html(res.responseText) - - self.each( callback, [res.responseText, status, res] ); + // 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(/