Push Unique Values to an Array

How to Push Unique Values to an Array


data.d.results is the given array and it will push only unique column values to an array.


var UnArr = [];

$.each(data.d.results, function(key, value) {
if ($.inArray(value.Title, UnArr) === -1) {
UnArr .push(value.Title);
}
});

The output UnArr [] Array will have only unique values now.

Comments

Popular posts from this blog

Customizing SharePoint list and implementing Quick search using jQuery

Clear DataTable on button click

Enable and Disable Client side People Picker using jQuery