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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<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