I have this function that gets a list of values back as an array from a web service and wires that list up to the autocomplete of some inputs (we don't know how many qualifying inputs will be on the page when the function runs). I've verified that I'm getting an array back from the web service call (JSON that gets parsed into an Array object). I'm thinking something must be wrong with the code that attaches to autocomplete. Any ideas?
function getDepartmentList() {
var dUrl = "/Service/Departments/?uid=" + userId;
$.ajax({
url: dUrl,
cache: false,
success: function (data) {
$("[id$=__Department]").die();
$("[id$=__Department]").live("keyup.autocomplete", function () {
$(this).autocomplete({
source: data
});
});
},
});
}