I use this code for my form
var formData = $("#form").serializeArray();
now I want to push an array into formData variable like this
[{"name":"xxxx"},{"name":"xxxx"}]
or push the array to object of the formData
Update: I want to send the data via ajax to server
any solution?
Very well I answer my question, forget about the serializeArray() so
var formData = {};
formData['X1'] = [];
item1 = {}
item1 ["name"] = "XXX";
formData['X1'].push(item1);
the result is:
{[{"name":"XXX"},{"name":"XXX"}]}
then send formData via ajax, it's easy, isn't it?