如何在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()
$.each(data, function(i, obj) { //use obj.id and obj.name here, for example: alert(obj.name); });