I am currently working with an array of objects and need to implement a filter on it. The objects in the list contain an owner_id property within the JSON...
Currently, I am looping through all the items in the array. However, I want to exclude those where the owner_id matches any value in my filterarray:
var filter = "[14657612, 2215375794]";
$.ajax({
url: 'myEndPOint',
dataType: 'json',
success: function(data) {
var media = data.media;
var arr = [];
_.filter(media, function(val){
//The filtering logic should be applied here to exclude items with owner_id that matches any value in the "filter" array
});
for(i=0; i < media.length; i++) {
var thumb = media[i].thumbnail;
var html = "<li><img src=" + thumb + " /></li>";
arr.push(html);
}
$(".social-ribbon-target").append(arr);
$(".loading").css("display", "none");*/
},
error: function(error) {
console.log("error");
}
});