Skip to content

Commit

Permalink
Much simplified jQuery.ajax (taking advantage of the fact the second …
Browse files Browse the repository at this point in the history
…argument of xhr.send overrides options)

Signed-off-by: jaubourg <aubourg.julian@gmail.com>
  • Loading branch information
jaubourg committed Jan 17, 2010
1 parent da3a7f5 commit 348b597
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/ajax.js
Expand Up @@ -314,26 +314,12 @@ jQuery.extend({
// Main method
ajax: function( url , s ) {

var xhr = jQuery.xhr();

if ( arguments.length === 1 ) {
s = url;
if ( s ) {
url = s.url;
}
url = s ? s.url : undefined;
}

if ( s ) {
xhr.open( s.type , url, s.async, s.username, s.password );
return xhr.send(s.data, s);
} else {
if ( url ) {
xhr.open( jQuery.ajaxSettings.type , url );
} else {
xhr.open();
}
return xhr.send();
}
return jQuery.xhr().open( s ? s.type : undefined , url ).send( undefined , s );

},

Expand Down

0 comments on commit 348b597

Please sign in to comment.