1
1
/*!
2
2
* jQuery Form Plugin
3
- * version: 3.09 (16-APR -2012)
3
+ * version: 3.11 (20-JUL -2012)
4
4
* @requires jQuery v1.3.2 or later
5
5
*
6
6
* Examples and documentation at: http://malsup.com/jquery/form/
@@ -210,17 +210,17 @@ $.fn.ajaxSubmit = function(options) {
210
210
this . trigger ( 'form-submit-notify' , [ this , options ] ) ;
211
211
return this ;
212
212
213
- // This is a utility function to fix deep serialization issues when doing file uploads
214
- // eg params show up as "[object Object]" rather than what it should be
215
- function formDeepSerialize ( extraData ) {
216
- var serialized = $ . param ( extraData ) . split ( '&' ) ;
217
- var result = { } ;
218
- var n ;
219
- for ( var i = 0 , l = serialized . length ; i < l ; i ++ ) {
220
- n = serialized [ i ] . split ( '=' )
221
- result [ decodeURIComponent ( n [ 0 ] ) ] = decodeURIComponent ( n [ 1 ] )
222
- }
223
- return result ;
213
+ // utility fn for deep serialization
214
+ function deepSerialize ( extraData ) {
215
+ var serialized = $ . param ( extraData ) . split ( '&' ) ;
216
+ var len = serialized . length ;
217
+ var result = { } ;
218
+ var i , part ;
219
+ for ( i = 0 ; i < len ; i ++ ) {
220
+ part = serialized [ i ] . split ( '=' ) ;
221
+ result [ decodeURIComponent ( part [ 0 ] ) ] = decodeURIComponent ( part [ 1 ] ) ;
222
+ }
223
+ return result ;
224
224
}
225
225
226
226
// XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
@@ -232,7 +232,7 @@ $.fn.ajaxSubmit = function(options) {
232
232
}
233
233
234
234
if ( options . extraData ) {
235
- var serializedData = formDeepSerialize ( options . extraData ) ;
235
+ var serializedData = deepSerialize ( options . extraData ) ;
236
236
for ( var p in serializedData )
237
237
if ( serializedData . hasOwnProperty ( p ) )
238
238
formdata . append ( p , serializedData [ p ] ) ;
@@ -267,11 +267,11 @@ $.fn.ajaxSubmit = function(options) {
267
267
}
268
268
269
269
s . data = null ;
270
- var beforeSend = s . beforeSend ;
271
- s . beforeSend = function ( xhr , o ) {
272
- o . data = formdata ;
273
- if ( beforeSend )
274
- beforeSend . call ( o , xhr , options ) ;
270
+ var beforeSend = s . beforeSend ;
271
+ s . beforeSend = function ( xhr , o ) {
272
+ o . data = formdata ;
273
+ if ( beforeSend )
274
+ beforeSend . call ( this , xhr , o ) ;
275
275
} ;
276
276
$ . ajax ( s ) ;
277
277
}
0 commit comments