将数组添加到序列化数据中

问题描述 投票:0回答:1

我想向我的序列化数据中添加一个数组。数组如下所示:

["1", "3"]

formData:

{"f_name":["tom","peter"],"l_name":["fel", "dan"]}

并且我想收到这个:

{"id":["1","3"],"f_name":["tom","peter"],"l_name":["fel", "dan"]}
javascript jquery post serialization
1个回答
0
投票

这样的事情?

array = ["1", "3"]
formData = {"f_name":["tom","peter"],"l_name":["fel", "dan"]}

formData["id"] = array
© www.soinside.com 2019 - 2024. All rights reserved.