Skip to content

Instantly share code, notes, and snippets.

@jesperronn
Forked from jharding/remote.html
Created October 15, 2015 12:33
Show Gist options
  • Select an option

  • Save jesperronn/fc05bc6dbcd7f4badbe2 to your computer and use it in GitHub Desktop.

Select an option

Save jesperronn/fc05bc6dbcd7f4badbe2 to your computer and use it in GitHub Desktop.

Revisions

  1. jesperronn revised this gist Oct 15, 2015. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions remote.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,7 @@
    var bestPictures = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    prefetch: '../data/films/post_1960.json',
    remote: {
    url: '../data/films/queries/%QUERY.json',
    wildcard: '%QUERY'
    }
    prefetch: '../data/films/post_1960.json'
    });

    $('#remote .typeahead').typeahead(null, {
  2. @jharding jharding revised this gist Apr 25, 2015. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions remote.js
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,14 @@ var bestPictures = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    prefetch: '../data/films/post_1960.json',
    remote: '../data/films/queries/%QUERY.json'
    remote: {
    url: '../data/films/queries/%QUERY.json',
    wildcard: '%QUERY'
    }
    });

    bestPictures.initialize();

    $('#remote .typeahead').typeahead(null, {
    name: 'best-pictures',
    displayKey: 'value',
    source: bestPictures.ttAdapter()
    display: 'value',
    source: bestPictures
    });
  3. @jharding jharding created this gist Mar 10, 2014.
    3 changes: 3 additions & 0 deletions remote.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <div id="remote">
    <input class="typeahead" type="text" placeholder="Oscar winners for Best Picture">
    </div>
    14 changes: 14 additions & 0 deletions remote.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    var bestPictures = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    prefetch: '../data/films/post_1960.json',
    remote: '../data/films/queries/%QUERY.json'
    });

    bestPictures.initialize();

    $('#remote .typeahead').typeahead(null, {
    name: 'best-pictures',
    displayKey: 'value',
    source: bestPictures.ttAdapter()
    });