I created a list in sharepoint gathering user information. Each entry has date. Some days have many entries. My goal is to create a select menu that has the dates. When I click the menu the dates populate but they repeat. How do I return them as a single value?
I've tried to nest another for loop and an if statement.
$.ajax({
url:url,
method:'GET',
headers:{ 'Accept': 'application/json; odata=verbose' },
success: function(data){
var dat = data.d.results;
for (var i = 0;i < dat.length; i++){
html+='<optionvalue='+itm.dateVal+'>'+itm.dateVal+'</option>';
} $('#week-selector').append(html);
},
error: function(e){
console.log('error:'+e);
}
});
The output I am getting is:
3/3/2019
3/3/2019
3/3/2019
3/3/2019
3/6/2019
3/6/2019
3/10/2019
3/10/2019
The output I want to get is:
3/3/2019
3/6/2019
3/10/2019