我使用jQuery 1.6动态创建和删除的JavaScript关联数组键和值
我不是JavaScript的这么好,我需要动态地创建具有2个动态参数数组:json.id
和json.name
。
数组创建应导致:
[
[json.id]
[
json.name,
json.name,
json.name,
etc .....
]
[json.id]
[
json.name,
json.name,
json.name,
etc ....
]
etc ...
]
然后,我需要能够删除json.id
或json.id json.name
....
有没有人能告诉我如何与做到这一点所有浏览器的支持?
THX 将帖子
的逻辑是这样的:(希望这是明确的:P)
//first ajax call result:
[{json.id_parent:json.name,json.id_parent:json.name,json.id_parent:json.name, etc..}]
//second ajax call results passing the json.id_parent:
[{json.id_parent_child:json.name,json.id_parent_child:json.name,json.id_parent_child:json.name,etc...}]
//now for each call = id_parent create an associative array:
{
id_parent:{id_parent_child,id_parent_child,etc ....},
id_parent:{id_parent_child,id_parent_child,etc ....},
etc...
}
2 dinamical paramas? –
数据来自您用来创建此数组的数据来自哪里? –
数据来自json ajax结果,对于每个ajax请求我有许多不同的json.id,然后对于每个json.id都有一个新的ajax调用,它检索许多与该json.id相关的不同json.name。我是 – sbaaaang