51224bdd17878b3b19e8987e9bb336a2

Hi This question is specific the Javascript.
I am showing the Auto complete on local javascript object.
My @local_search_objects has an 5000 objects, and I need to cache them.
I couldn't understand hot to do that.

<script type="text/javascript">

  

  var contacts = <%=@local_search_objects.to_json %> ;

  var typeahead = new Autocompleter.LocalAdvanced('autocomplete_input', 'autocomplete_populate', contacts, {
    frequency: 0.1,
    updateElement: addContactToList,
    search_field: "name"
  });
  

</script>

Refactorings

No refactoring yet !

Your refactoring





Format Copy from initial code

or Cancel