X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=form%2Fform.js;h=f391fcf1751727893a0a992563db46063fe2b6e2;hb=274d8b7927c6027265402dab35303ce20c4d00a0;hp=bec88706afc657d15239219008572f78ef89b038;hpb=55f08065a9a2758134bc2dee6b338b888d073967;p=jquery.git diff --git a/form/form.js b/form/form.js index bec8870..f391fcf 100644 --- a/form/form.js +++ b/form/form.js @@ -127,6 +127,19 @@ $.fn.ajaxForm = function(target, post_cb, pre_cb) { }); }; +/* + +$.ajax({ + type: "POST", + url: "foo.cgi", + data: $.param( $("form").formdata() ), + success: function(){}, + error: function(){}, + complete: function(){} +}); + + */ + /** * A simple wrapper function that sits around the .serialize() * method, allowing you to easily extract the data stored within @@ -198,9 +211,7 @@ $.fn.serialize = function() { if ((p == 'SELECT' || p == 'OPTGROUP') && !this.selected) return; var n = this.name; - if (!n && p == 'OPTGROUP' && (par = par.parentNode)) - n = par.name; - + if (!n) n = (p == 'OPTGROUP') ? par.parentNode.name : (p == 'SELECT') ? par.name : this.name; if (n == undefined) return; a.push({name: n, value: this.value});