title: redirecting to another page on pressing "enter" in the search text box
body: <p>i have a search text box where the text for searching is entered and on pressing "enter" key, it should redirect to another page according to the type of the text using jquery.</p>
  
  <p>here is my html</p>
  
  <pre><code>&lt;div class="search"&gt;
       &lt;form role="form"&gt;
          &lt;input type="text" id="pagesearch" class="search-form" autocomplete="off" placeholder="Search"&gt;&lt;i class="fa fa-search srch"&gt;&lt;/i&gt;
       &lt;/form&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>and here is my jquery part.</p>
  
  <pre><code>$(document).keypress(function(event){    
                  if(event.which==13){
                          //alert('enter entered');
                          $('.srch').trigger('click');
              }   
              });
  
              $(document).on('click','.srch',function(e){
                  e.preventDefault();
                  var search_text = $('#pagesearch').val();
                  //alert(search_text);
                  if(search_text == 'qbcd' || search_text == 'QBCD'){
                      //alert('qbcd searched');
                      location.href = "page1.html";
                      //$(location).attr('href','page1.html');
                  }else if(search_text == 'qbickle' || search_text == 'QBICKLE'){
                      //alert('qbickle searched');
                      $(location).attr('href','page2.html');
                      //location.href = "page2.html";
                  }else{
                      alert('specified content for search is unavailable');
                  }
              });
  </code></pre>
  
  <p>i used <code>location.href</code>, <code>window.location</code> and <code>window.location.href</code> but i'm unable to redirect to other pages.
  kindly help me.
  thanks in advance. </p>