I know this questions been asked before, I've read other posts and couldn't get it to work.
I'm trying to populate a drop down menu with JSON data but I'm having some issues, the drop down appears on my html page but theres nothing in the drop down, not even the "Please Select". Below is my code, do you see any problems with it.
HTML
<select id="dropDown">
</select>
JavaScript
$(document).ready(function () {
$.ajax({
url: 'http://localhost/api/Dynamic?database=',
dataType: 'Json',
success: function (results) {
var $el = $("#dropDown");
$el.empty(); // remove old options
$el.append($("<option></option>")
.attr("value", '').text('Please Select'));
$.each(results, function (index, value) {
$el.append($("<option></option>")
.attr("value", value).text(value));
});
}
});
});
JSON
["Item1","Item2","Item3","Item4"]