How to iterate json data in jquery

前端 未结 4 1359
误落风尘
误落风尘 2020-11-27 20:58

How to iterate the json data in jquery.

[{\"id\":\"856\",\"name\":\"India\"},
 {\"id\":\"1035\",\"name\":\"Chennai\"},
 {\"id\":\"1048\",\"name\":\"Delhi\"},         


        
4条回答
  •  感情败类
    2020-11-27 21:46

    iterate on all the object's properties with the $.each function. in each iteration you'll get the name/key and the value of the property:

    $.each(data, function(key, val) {
      alert(key+ " *** " + val);
    });
    

提交回复
热议问题