gpt4 book ai didi

jquery - 如何在jquery中迭代json数据

转载 作者:行者123 更新时间:2023-12-03 21:45:04 25 4
gpt4 key购买 nike

如何在jquery中迭代json数据。

[{"id":"856","name":"India"},
{"id":"1035","name":"Chennai"},
{"id":"1048","name":"Delhi"},
{"id":"1113","name":"Lucknow"},
{"id":"1114","name":"Bangalore"},
{"id":"1115","name":"Ahmedabad"},
{"id":"1116","name":"Cochin"},
{"id":"1117","name":"London"},
{"id":"1118","name":"New York"},
{"id":"1119","name":"California"}
]

最佳答案

您可以使用$.each()像这样:

$.each(data, function(i, obj) {
//use obj.id and obj.name here, for example:
alert(obj.name);
});

关于jquery - 如何在jquery中迭代json数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4233354/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com