我正在尝试使用以下代码将不同的值提取到下拉列表中,但它没有引入唯一的字符串,有人可以帮忙吗?
功能 build_refinesearch_cancer_combo() {
$('#combolist-cancer-type').empty();
var list = [];
var htmlResults = '<option value="-1" selected>Select cancer type_</option>';
for (var i = 0; i < user.length; i++) {
CancerID = user[i].FKCancerTypeID;
Cancer = user[i].Cancer;
if (Cancer != list) {
htmlResults += '<option value="' + CancerID + '">' + Cancer + '</option>';
list = Cancer;
}
}
$('#combolist-cancer-type').append(htmlResults);
}