clear select dropdown js
var courses = document.getElementById("special_selection");
// clear select
var length = courses.options.length;
for (i = length - 1; i >= 0; i--) {
courses.options[i] = null;
}
for (var i = 0; i < data.length; i++) {
var option = document.createElement("OPTION"),
txt = document.createTextNode(data[i].coursetitle);
option.appendChild(txt);
option.setAttribute("value", data[i].KF);
courses.insertBefore(option, courses.lastChild);
}