Make sure that null params aren't traversed. Fixes #5794.
[jquery.git] / src / ajax.js
index 83e5bdc..3c199af 100644 (file)
@@ -455,10 +455,11 @@ jQuery.extend({
                try {
                        var oldAbort = xhr.abort;
                        xhr.abort = function() {
-                               oldAbort.call( xhr );
-
                                if ( xhr ) {
-                                       xhr.readyState = 0;
+                                       oldAbort.call( xhr );
+                                       if ( xhr ) {
+                                               xhr.readyState = 0;
+                                       }
                                }
 
                                onreadystatechange();
@@ -477,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
@@ -664,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 );