Reputation: 12178
I'm trying to get JQueryUI's autocomplete to work with an AJAX call to populate the source array.
however, I apparently I'm doing things out of order. How can I fix this so that it works?
(PageMethods returns its JSON list, but its not binding to the select)
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
<script type="text/javascript" >
$(".aaa").autocomplete({
source: list,
search: function(event, ui) {
PageMethods.FilterDropdown($(this).attr("id"), $(this).val(), OnSucceeded);
}
});
function OnSucceeded(result) {
list = result;
}
</script>
Upvotes: 0
Views: 1317
Reputation: 12178
This appears to do it. I was missing a direct way to pass the callback to source:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
<script type="text/javascript" >
$(document).ready(function() {
$(".aaa").autocomplete({
source: function(request, response) {
PageMethods.FilterDropdown("txname", $("#txname").val(), function(data) {
return response(data);
});
}
});
});
</script>
Upvotes: 3