I'm trying to eliminate duplicate array values and get distinct values in knockout js
.
My code is as follows
$.ajax({
url: 'http://localhost:53489/api/datacollect/GetPatientUDData',
type: "GET",
dataType: 'json',
success: function(data) {
for (var i = 0; data.length; i++) {
vModel.UDTableDesc.push(data[i]);
}
},
error: function(xhr, textStatus, errorThrown) {
console.log('Error in Operation');
}
});
function viewModel() {
var viewModel = this;
viewModel.UDTableDesc = ko.observableArray();
return viewModel;
}
var vModel = new viewModel();
ko.applyBindings(vModel, document.getElementById("MainTree"));
Any suggestions would be great!