Exactly.  jQuery doesn't know which <input type="submit"> was clicked
by the time it gets around to the serialize method.  jQuery knows all
the form input types, but which submit button was clicked?  Which
input type image was clicked?  It is because of lines 3296 and 3297 of
the serialize function in jQuery.  Here are the two source code lines
and the complete methods are listed below for serialize() and
serializeArray() (serializeArray is called by serialize):


3296 (this.checked || /select|textarea/i.test(this.nodeName) ||
3297 /text|hidden|password|search/i.test(this.type));



        serialize: function() {
                return jQuery.param(this.serializeArray());
        },
        serializeArray: function() {
                return this.map(function(){
                        return this.elements ? jQuery.makeArray(this.elements) 
: this;
                })
                .filter(function(){
                        return this.name && !this.disabled &&
                                (this.checked || 
/select|textarea/i.test(this.nodeName) ||
                                        
/text|hidden|password|search/i.test(this.type));
                })
                .map(function(i, elem){
                        var val = jQuery(this).val();
                        return val == null ? null :
                                jQuery.isArray(val) ?
                                        jQuery.map( val, function(val, i){
                                                return {name: elem.name, value: 
val};
                                        }) :
                                        {name: elem.name, value: val};
                }).get();
        }

It's not checking for input type submit elements.  However, you have
it right in your "click" event handler, so use this little workaround:

            var post = $(this).attr("name") + "=" + $(this).val();
            var data = $(this.form).serialize() + "&" + post;

Reply via email to