I'm doing the following:
var data = $(form).serializeArray();
// Now I want to add another value on this data
data.username = 'this is username';
I want to know how can I add another value after doing serializeArray()
. I tried all the things I know, but nothing is getting it to work. any ideas pls.
var data = $(form).serializeArray();
data.push({name: 'username', value: 'this is username'});
see also: jQuery post() with serialize and extra data
try
data[data.length] = { name: "username", value: "The Username" };
var FormAttr = $('#form_id').serializeArray();
FormAttr.push({name: "Name_Of_Attribute", value:"Value_Of_Attributes"});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With