According to the jQuery UI, you should set the autocomplete source after create/init as follows:
$( ".selector" ).autocomplete( "option", "source", ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] );
Here is some of the code (based off of the combobox example):
$("#item").combobox();
$("#item").autocomplete("option", "source", function (request, response) {
$.ajax({
type: "POST",
url: "itmsrch.ashx",
dataType: "json",
data: {
dept: $("#dept").val,
term: request.term
},
success: function (data) {
response($.map(data, function (item) {
return {
label: item.name,
value: item.name
}
}));
}
});
});
After typing the required 2 characters to kick off the autocomplete action, I am getting an error that the source is not set. Any ideas?