Hi folks,
this is a continuation from a previous JQueryUI Autocomplete question, I asked.
This time, I have my data returning ... but I have no idea how i define what html to show and how to dynamically update that html with my results.
So, here's my jquery ....
Home.js
function AutoComplete(element) {
var cache = {};
$(element).autocomplete({
minLength: 2,
source: function (request, response) {
if (request.term in cache) {
response(cache[request.term]);
return;
}
else {
$.getJSON("/api/autocomplete/" +
encodeURIComponent(request.term),
function (data) {
cache[request.term] = data;
response(data);
});
}
}
});
}
and this is wired up in my View
Index.aspx
<script type="text/javascript">
$(document).ready(function () {
AutoComplete("#searchQuestion");
})
</script>
Now .. i'm not sure how i tell it to use some (yet to be made) html/div/etc. ... and then to populate that <ul>
list (i'm assuming i extend the callback, above .. instead of calling this response(data)
method .. wtf is that?)