I have array like this:
var arr = [
{"id":1,"tipe":"foo"},
{"id":2,"tipe":"bar"},
{"id":3,"tipe":"bar"}
];
how to get unique data on javascript or jquery, and show result like this:
[{"id":1,"tipe":"foo"},{"id":2,"tipe":"bar"}];
this is my code for get the data:
$('#tipe').change(function(){
var val = $(this).val();
url = '{{url('getdata')}}';
$.ajax({
url:url,
data: {tipe:val}
}).done(function(data){
$('#page').empty();
$.each(data, function(key, value){
$('#page').append(value['halaman']);
});
})
});