"then" renamed "complete" and new "then" method defined using "complete" and "fail...
[jquery.git] / src / ajax.js
index 46e5a14..32f75f6 100644 (file)
@@ -51,9 +51,9 @@ jQuery.fn.extend({
                                type = "POST";
                        }
                }
-               
+
                var self = this;
-               
+
                // Request the remote document
                jQuery.ajax({
                        url: url,
@@ -107,9 +107,9 @@ jQuery.fn.extend({
                                null :
                                jQuery.isArray(val) ?
                                        jQuery.map( val, function(val, i){
-                                               return {name: elem.name, value: val};
+                                               return {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
                                        }) :
-                                       {name: elem.name, value: val};
+                                       {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
                }).get();
        }
 });
@@ -496,9 +496,9 @@ jQuery.extend({
                
                // Attach deferreds
                deferred.promise( jXHR );
-               jXHR.success = jXHR.then;
+               jXHR.success = jXHR.complete;
                jXHR.error = jXHR.fail;
-               jXHR.complete = completeDeferred.then;
+               jXHR.complete = completeDeferred.complete;
 
                // Remove hash character (#7531: and string promotion)
                s.url = ( "" + s.url ).replace( rhash , "" );
@@ -643,19 +643,19 @@ jQuery.extend({
                                value = jQuery.isFunction(value) ? value() : value;
                                s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
                        };
-               
+
                // Set traditional to true for jQuery <= 1.3.2 behavior.
                if ( traditional === undefined ) {
                        traditional = jQuery.ajaxSettings.traditional;
                }
-               
+
                // If an array was passed in, assume that it is an array of form elements.
                if ( jQuery.isArray(a) || a.jquery ) {
                        // Serialize the form elements
                        jQuery.each( a, function() {
                                add( this.name, this.value );
                        });
-                       
+
                } else {
                        // If traditional, encode the "old" way (the way 1.3.2 or older
                        // did it), otherwise encode params recursively.
@@ -688,7 +688,7 @@ function buildParams( prefix, obj, traditional, add ) {
                                buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
                        }
                });
-                       
+
        } else if ( !traditional && obj != null && typeof obj === "object" ) {
                // If we see an array here, it is empty and should be treated as an empty
                // object
@@ -701,7 +701,7 @@ function buildParams( prefix, obj, traditional, add ) {
                                buildParams( prefix + "[" + k + "]", v, traditional, add );
                        });
                }
-                                       
+
        } else {
                // Serialize scalar item.
                add( prefix, obj );
@@ -901,7 +901,7 @@ if ( window.ActiveXObject ) {
                        return new window.XMLHttpRequest();
                } catch( xhrError ) {}
        }
-       
+
        try {
                return new window.ActiveXObject("Microsoft.XMLHTTP");
        } catch( activeError ) {}