X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fajax.js;h=f1de0f8c52d93c31c941794364f991624ee32be8;hb=28ce15979f69903f2fe1187705b190968757ddf7;hp=02322ab3944482848f3589b8387d3b3182640993;hpb=61983cbf176c599687c36ffbf4b64ae8697486a3;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 02322ab..f1de0f8 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -457,7 +457,9 @@ jQuery.extend({ xhr.abort = function() { if ( xhr ) { oldAbort.call( xhr ); - xhr.readyState = 0; + if ( xhr ) { + xhr.readyState = 0; + } } onreadystatechange(); @@ -476,7 +478,7 @@ jQuery.extend({ // Send the data try { - xhr.send( type === "POST" || type === "PUT" ? s.data : null ); + xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); } catch(e) { jQuery.handleError(s, xhr, null, e); // Fire the complete handlers @@ -528,7 +530,7 @@ jQuery.extend({ handleError: function( s, xhr, status, e ) { // If a local callback was specified, fire it if ( s.error ) { - s.error.call( s.context || window, xhr, status, e ); + s.error.call( s.context || s, xhr, status, e ); } // Fire the global callback @@ -663,7 +665,7 @@ jQuery.extend({ } }); - } else if ( !traditional && typeof obj === "object" ) { + } else if ( !traditional && obj != null && typeof obj === "object" ) { // Serialize object item. jQuery.each( obj, function( k, v ) { buildParams( prefix + "[" + k + "]", v );