Changeset 4650
- Timestamp:
- 02/05/08 20:05:23 (10 months ago)
- Location:
- trunk/plugins/form
- Files:
-
- 2 modified
-
jquery.form.js (modified) (3 diffs)
-
test/index.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/form/jquery.form.js
r4488 r4650 1 1 /* 2 2 * jQuery Form Plugin 3 * version: 2.0 3 (01/20/2008)3 * version: 2.04 (02/05/2008) 4 4 * @requires jQuery v1.1 or later 5 5 * … … 193 193 194 194 var a = this.formToArray(options.semantic); 195 if (options.data) {196 for (var n in options.data)197 a.push( { name: n, value: options.data[n] } );198 }195 if (options.data) { 196 for (var n in options.data) 197 a.push( { name: n, value: options.data[n] } ); 198 } 199 199 200 200 // give pre-submit callback an opportunity to abort the submit … … 327 327 xhr.responseText = doc.body ? doc.body.innerHTML : null; 328 328 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 329 xhr.getResponseHeader = function(header){ 330 var headers = {'content-type': opts.dataType}; 331 return headers[header]; 332 }; 329 333 330 334 if (opts.dataType == 'json' || opts.dataType == 'script') { 331 335 var ta = doc.getElementsByTagName('textarea')[0]; 332 data = ta ? ta.value : xhr.responseText; 333 if (opts.dataType == 'json') 334 eval("data = " + data); 335 else 336 $.globalEval(data); 336 xhr.responseText = ta ? ta.value : xhr.responseText; 337 337 } 338 else if (opts.dataType == 'xml') { 339 data = xhr.responseXML; 340 if (!data && xhr.responseText != null) 341 data = toXml(xhr.responseText); 338 else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) { 339 xhr.responseXML = toXml(xhr.responseText); 342 340 } 343 else { 344 data = xhr.responseText; 345 } 341 data = $.httpData(xhr, opts.dataType); 346 342 } 347 343 catch(e){ -
trunk/plugins/form/test/index.html
r2234 r4650 152 152 $('#form1').clearForm(); 153 153 val = $el.val(); 154 ok( '' ==val, 'success: ' + val);154 ok( !val, 'success: ' + val); 155 155 }); 156 156
