this code gives me an error when submitting he form "undefined is not a function in line 21" and I don't know why
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
$("form[name=dForm]").submit(function(ev){
ev.preventDefault();
var data = $(this).serializeObject();
data.push({name:"bonjour",value:bonjour});
// do something here ...
})
or it must be an array not an object?