Skip to content

Instantly share code, notes, and snippets.

@meeech
Created November 23, 2010 23:09
Show Gist options
  • Save meeech/712733 to your computer and use it in GitHub Desktop.
Save meeech/712733 to your computer and use it in GitHub Desktop.
// Create new YUI instance, and populate it with the required modules
YUI().use('autocomplete', function(Y) {
//Begin Closure
//Used to parse out the JSONP reponse from the server.
YUI.namespace('Vault.ac').parseResponse = function(results) {
return results;
};
if(Y.one('#q')) {
var autoComplete = new Y.AutoComplete({
source : 'http://localhost/vault/entries/find?phrase={query}&callback=YUI.Vault.ac.parseResponse',
inputNode: '#q',
resultListLocator: function() {
console.log(arguments);
return 'bbb';
},
resultTextLocator: function() {
console.log(arguments);
return 'aaaaaa';
}
});
autoComplete.render();
}
//End closure
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment