title: Javascript rails auto complete search drop down click event
body: <p>I have a <a href="http://jsfiddle.net/freit5/NmxDw/1/" rel="nofollow">twitter typeahead auto complete search box</a> working and my next step is to be able to click or hit enter on a result and be taken to the item's page.</p>
  
  <p>Any ideas or working examples I can look at? I've looked at options like swiftype.com but would rather do it the hard way first.</p>
  
  <pre><code>$(document).ready(function() {
  $('input.typeahead').typeahead({
  name: 'names',
  prefetch: '../sub_categories/names',
  remote: '../sub_categories/names?q=%QUERY',
  minLength: 2,
  limit: 10,
  select: function(event, ui){
    start_search=false;
    $('search_item_id').value = ui.item.id;
    $('search_item_type').value = ui.item.klass;
    $('search_form').submit();
    }
   });
  });
  </code></pre>