title: Javascript get input and perform search function without sumbit button
body: <p>I'm trying to get input from a textbox and use that value to perform a search without a submit button.So when the input in textbox changes, the page will display the corresponding search research result. After some search online below is what I have at the moment. It doesn't work. Nothing happens when I typed in the textbox. Can someone please help? Many thanks! I commented in the code as well. </p>
  
  <pre><code>&lt;form name="form" method="post"/&gt;   
           &lt;input type="text" id="search" /&gt;  //when content in this text box changes, perform goSearch() and display result          
           &lt;script type="text/javascript"&gt;                    
              var input = document.getElementById("search");
              function goSearch(){
                      var keyword = input.value; //get the input from textbox
                      //send keyword to search
                      var searchuri= somebaseuri +keyword; //send keyword with uri
                          var xhr = new XMLHttpRequest();
                          xhr.open("GET", searchuri,true);
                          xhr.setRequestHeader("Accept", "application/json");
                          xhr.onload= function(){
                              var list = JSON.parse(xhr.responseText);
                              showResult(list);
                          }   
                          xhr.send(null);                         
                  } 
                  function showResult(list){
                       //format and display the result we get from the server
                      }
  
              input.onchange = goSearch(); //when input is changed, perform search function
              input.onblur =goSearch();
          }   
      &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>