You can add an event handler like this
$('#txtDemo').on('change', function(){
var value = $(this).val();
Demo (value); //pass the value as paramter
});
//Handle it here
function Demo (value) {
//code for getting value from code behind in the form of array
}
From your comments: Possible using select
select( event, ui )Type: autocompleteselect
Triggered when an item is selected from the menu. The default action is to replace the text field's value with the value of the selected item.
$("#txtDemo").autocomplete({
source: availableTags,
select: function( event, ui ) {
demo(ui.item.value);
}
});
Here is sample working fiddle
Hope you can understand.