aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-20 16:22:36 +0100
committerjaubourg <j@ubourg.net>2011-01-20 16:22:36 +0100
commit3e1d3d0f21d1b292fe721b4f483b3a3bc2dadd86 (patch)
tree23a75ae28d81688a0d2be7071bc1013d55514915
parent9ab00a712fe3757f130dce8b42293c82a68c690e (diff)
downloadjquery-3e1d3d0f21d1b292fe721b4f483b3a3bc2dadd86.tar.gz
jquery-3e1d3d0f21d1b292fe721b4f483b3a3bc2dadd86.zip
Revises the way arguments are handled in ajax.
-rw-r--r--src/ajax.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 63914d23a..dd3c50d80 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
@@ -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+/ );