Skip to content

Instantly share code, notes, and snippets.

@rgrove
Created April 3, 2013 21:05
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 rgrove/5305286 to your computer and use it in GitHub Desktop.
Save rgrove/5305286 to your computer and use it in GitHub Desktop.
YUI().use('autocomplete', 'jsonp', function (Y) {
var ac = new Y.AutoComplete({
source: function (query, callback) {
Y.jsonp('http://example.com/api/autocomplete?query=' + encodeURIComponent(query) + '&callback={callback}', {
timeout: 10000 // 10 seconds,
on: {
success: callback,
failure: function () { /* ... */ },
timeout: function () { /* ... */ }
}
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment