how to get distinct values from json in jquery

后端 未结 3 702
走了就别回头了
走了就别回头了 2020-12-31 15:13

I\'ve got a jquery json request and in that json data I want to be able to sort by unique values. so I have

{
  \"people\": [{
        \"pbid\": \"626\",
           


        
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-31 15:50

    function(data){
        var arr = new Array();
        $.each(data.people, function(i, person){
            if (jQuery.inArray(person.birthDate, arr) === -1) {
                alert(person.birthDate);
                arr.push(person.birthDate);
            }
        });
    }
    

提交回复
热议问题