Skip to content

Instantly share code, notes, and snippets.

@benjaminmateev
Created August 4, 2011 14:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjaminmateev/1125355 to your computer and use it in GitHub Desktop.
Save benjaminmateev/1125355 to your computer and use it in GitHub Desktop.
jQuery UI Autocomplete in Coffeescript
$ ->
$('#header_search').autocomplete
source: "/search/autocomplete"
formatItem: (item) ->
"<img src=\"#{item.url}\" />#{item.title}"
select: (event, ui) ->
location.href = ui.item.href
@benjaminmateev
Copy link
Author

Getting this from /search/autocomplete
[{"title":"test123","url":"/I008111m.jpg","href":"/search?search=short"}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment