I would like to take the results of my $.getJSON
and place that JSON data, specifically the facility. FacilityName, as the values for the array availableTags. I have tried executing a function call where you see the // TODO: but I am not getting this sorted out. I'm sure it is easy for your jQuery experts! I DO see the facilities displayed on my page in the <div id="info"></div>
tag as I would expect.
<script type="text/javascript">
$(function () {
$('#datePicker').datepicker();
});
var names = [];
$.getJSON('FacilitiesAsync','sourceDb=myDb',processFacilities);
function processFacilities(data) {
$.each(data, function (facilities, facility) {
names += facility.FacilityName;
}); // end of each
alert(names);
$("#tags").autocomplete("source", names);
};
$(function () {
$("#tags").focusout(function () {
$.ajax({
beforeSend: function() {
alert("Testing");
},
complete: function () {
alert("Done!");
}
});
});
});
</script>