I’m creating an autocomplete from a page that returnes values as a text list, one per line, like so:
CAAA/CODE1\n
CAAA/CODE2\n
CAAA/CODE3\n
I can see from Inspecting the Network from within Chrome, that the AJAX call is being made, and the data is being returned, but it is not showing the autocomplete box below, containing the values.
It’s like the response is not being sent back to the autocomplete.
Here’s my code:
$("input#prodcode").autocomplete({
source: function (request, response) {
$.ajax({
url: "ProductCodes.aspx",
dataType: "text",
type: "post",
data: { code_search: "hello" },
success: function (data) {
response(data);
}
});
},
minLength: 2
});
You need to provide either URL or Array data as parameter. You can use: