From 0effce56c2213147c335c00ed39ba30792093d90 Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 26 May 2017 16:15:13 +0200 Subject: [PATCH] Search form can perform a request on the database --- assets/js/components/searchForm/searchForm.js | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/assets/js/components/searchForm/searchForm.js b/assets/js/components/searchForm/searchForm.js index d416a2b8..0660d513 100644 --- a/assets/js/components/searchForm/searchForm.js +++ b/assets/js/components/searchForm/searchForm.js @@ -26,15 +26,6 @@ ComunicWeb.components.searchForm = { var searchBoxContainer = createElem("div", searchBoxCore); searchBoxContainer.className = "searchBoxResultsContainer"; - //Create menu list - var menuList = createElem("ul", searchBoxContainer); - menuList.className = "menu"; - - //Enable slimscroll - /*$(menuList).slimScroll({ - height: '200px', - }));*/ - //Create footer var searchFooter = createElem("li", searchResultBox); searchFooter.className = "footer"; @@ -77,5 +68,25 @@ ComunicWeb.components.searchForm = { //Change "see more result" value footerLink.setAttribute("data-searchValue", textInput.value); + + //Perform a request on the server + apiURI = "search/request"; + params = { + query: textInput.value, + }; + ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, function(){ + //Remove any remainging element in searchResultBox + console.log("result"); + //Create menu list + var menuList = createElem("ul", searchBoxContainer); + menuList.className = "menu"; + + //Enable slimscroll + /*$(menuList).slimScroll({ + height: '200px', + }));*/ + }); + + }, } \ No newline at end of file