diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-05 23:21:44 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-05 23:21:44 +0100 |
commit | 9b12691ad66269ca8b67e80516548e8ae10bd7b2 (patch) | |
tree | 6df55bd94d02b216cb2ec51899f0d0e78899d3e2 /module/web | |
parent | fixed position of autocompletion, updated libraries (diff) | |
download | pyload-9b12691ad66269ca8b67e80516548e8ae10bd7b2.tar.xz |
working search suggestions
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/static/js/views/filterView.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/module/web/static/js/views/filterView.js b/module/web/static/js/views/filterView.js index ea0aff0d5..19501430a 100644 --- a/module/web/static/js/views/filterView.js +++ b/module/web/static/js/views/filterView.js @@ -29,7 +29,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], $.fn.typeahead.Constructor.prototype.show = show; this.$('.search-query').typeahead({ minLength: 2, - source: this.getAutocompletion + source: this.getSuggestions }); this.stateMenu = this.$('.dropdown-toggle .state'); @@ -43,10 +43,15 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], return this; }, - getAutocompletion: function() { - return ["static", "autocompletion", "demo", "with", "some", "keywords", - "a very long proposal for autocompletion", "autobot", - "a very long proposal for autocompletion second one"]; + getSuggestions: function(query, callback) { + console.log(callback); + $.ajax('/api/searchSuggestions', { + method: 'POST', + data: {pattern: JSON.stringify(query)}, + success: function(data) { + callback(data); + } + }); }, switch_filter: function(e) { |