X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=dd3c50d80f2a213dfbcdccd7c9d8117177cb70c8;hb=3e1d3d0f21d1b292fe721b4f483b3a3bc2dadd86;hp=fc1ecfde373a9fbc4e99e4d5850aeb4a14444572;hpb=64e1cdbb95b8bbefbc9dec70ae30e0714a549619;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index fc1ecfd..dd3c50d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -291,18 +291,16 @@ jQuery.extend({ // Main method ajax: function( url , options ) { - // Handle varargs - if ( arguments.length === 1 ) { + // If options is not an object, + // we simulate pre-1.5 signature + if ( typeof( options ) !== "object" ) { options = url; - url = options ? options.url : undefined; + url = undefined; } // Force options to be an object options = options || {}; - // Get the url if provided separately - options.url = url || options.url; - var // Create the final options object s = jQuery.extend( true , {} , jQuery.ajaxSettings , options ), // jQuery lists @@ -427,10 +425,8 @@ jQuery.extend({ // Stored error error, - // Keep track of statusCode callbacks - oldStatusCode = statusCode; - - statusCode = undefined; + // To keep track of statusCode based callbacks + oldStatusCode; // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { @@ -588,6 +584,8 @@ jQuery.extend({ } // Status-dependent callbacks + oldStatusCode = statusCode; + statusCode = undefined; jXHR.statusCode( oldStatusCode ); if ( s.global ) { @@ -630,7 +628,8 @@ jQuery.extend({ }; // Remove hash character (#7531: and string promotion) - s.url = ( "" + s.url ).replace( rhash , "" ); + // We also use the url parameter if available + s.url = ( "" + ( url || s.url ) ).replace( rhash , "" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( /\s+/ );