I'm trying to use the jquery ui autocomplete feature with an ajax datasource and I just can't see what is wrong with my code.
Here is my code
$(document).ready(function () {
var data = new Portalen.LitteraNumberData();
$("#LitteraNumber").autocomplete({
minLength: 1,
source : function (request, response) {
var customerId = $("#CustomerId").val();
return response(data.loadLitteraNumbers(customerId));
}
});
});
and in a js file I have this:
Portalen.LitteraNumberData = function () { };
Portalen.LitteraNumberData.prototype = function() {
var loadLitteraNumbers = function(customerId) {
$.get("/Orders/GetLitteraNumbers", { customerId: customerId }, function (response) {
return response;
});
};
return {
loadLitteraNumbers: loadLitteraNumbers
};
}();
The ajax call is working, I get the correct response but the autocomplete feature just wont happen. Is LitteraNumberData returning the wrong thing? All suggestions are appreciated.