jquery - Django search box on separate page from results -


i have search box in django site that's code looks this:

<li>     <i class="search fa fa-search search-btn"></i>     <form action="" method="get" class="search-open">         <div class="input-group animated fadeindown">             <input id="searchfield" type="text" class="form-control" placeholder="search" name="searchfield">             <span class="input-group-btn">                 <button id="searchbutton" class="btn-u" type="button">go</button>             </span>         </div>     </form> </li> 

i need submit search form , have go through django view wont cooperate. i've tried few methods can seem things work if page displaying results same page search form not case here.

any or suggestions ton. have search function , , template display things need redirect /search-results preferably using {% url 'search-results' %}

edit:

i tried putting {% templatetag openblock %}url 'search-results'{% templatetag closeblock %} in form's action error page not found because renders url this: 127.0.0.1:8000/%7b%25%20url%20'search-results%20%25%7d?q=querygoeshere work perfect if access correct view using url, don't know how use django template tags , not create retarded url string. if {% url 'search-results %}` error have escape them way @ least. stumped.

type in js file

var submit=document.queryselector('#searchbutton'); var input=document.queryselector('#searchfield'); submit.addeventlistener("click",calc,false);  function calc(){     var b = input.value;      """set value of b equal input in searchfield"""     var = [];     a.push(b);     """to store value of b in array a"""     document.getelementbyid('searchfield').value="";     """to set value of searchfield blank"""     b.clear(); } 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -