X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fajax.js;h=697365a2ff232bb94fa79654e7ea12f5ba5e055f;hb=3a23a5c17dd0522da06db8f36890f134f9004de6;hp=353c824ff7db7a3bbfe765c66ff4290a27869f85;hpb=513053d62ba86ca6ab1f4646fdac3ec6819b2db9;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 353c824..697365a 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -15,6 +15,10 @@ jQuery.fn.extend({ load: function( url, params, callback ) { if ( typeof url !== "string" ) { return this._load( url ); + + // Don't do a request if no elements are being requested + } else if ( !this.length ) { + return this; } var off = url.indexOf(" "); @@ -194,7 +198,7 @@ jQuery.extend({ ajax: function( s ) { // Extend the settings, but re-extend 's' so that it can be // checked again later (in the test suite, specifically) - s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); + s = jQuery.extend(true, {}, jQuery.ajaxSettings, s); var jsonp, status, data, callbackContext = s.context || window, @@ -469,7 +473,7 @@ jQuery.extend({ function success(){ // If a local callback was specified, fire it and pass it the data if ( s.success ) { - s.success.call( callbackContext, data, status ); + s.success.call( callbackContext, data, status, xhr ); } // Fire the global callback