X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=697365a2ff232bb94fa79654e7ea12f5ba5e055f;hb=990d9ca1b05a587cce7599a1a40aa2558117db41;hp=1cb7ee5b16793305d06ede2be81f622fc51fcbd3;hpb=50cf4351a6c4b0031f268279b093e38850b90cd6;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 1cb7ee5..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, @@ -457,6 +461,8 @@ jQuery.extend({ xhr.send( type === "POST" || type === "PUT" ? s.data : null ); } catch(e) { jQuery.handleError(s, xhr, null, e); + // Fire the complete handlers + complete(); } // firefox 1.5 doesn't fire statechange for sync requests @@ -467,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