Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gnrlbzik
Created August 11, 2011 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnrlbzik/1140631 to your computer and use it in GitHub Desktop.
Save gnrlbzik/1140631 to your computer and use it in GitHub Desktop.
ui autocomplete - Stack Overflow Question
var serverSearchField = $("#txtSearchServer");
var listServers = [];
serverSearchField.autocomplete({
source: listServers
});
serverSearchField.keyup(function (event) {
$.ajax({
url: 'edit/EditService.svc/SearchServers',
type: 'GET',
data: { 'term': $("#txtSearchServer").val() },
dataType: 'json',
success: function (data) {
$.map(data.d, function (item) {
///working here to do server autocomplete!!!!!!!
listServers.push(item.ServerName);
});
serverSearchField.autocomplete('option','source',listServers);
},
error: function (a, b, c) {
$('.Toast').html('Error Retreiving Servers for autocomplete!');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment