title: Uncaught TypeError: Cannot set property 'value' of null
body: <p>I'm trying to pass the entered text to the controller using an ajax request. But i'm getting athe error  "Uncaught TypeError: Cannot set property 'value' of null " when I tried to execute JS file..</p>
  
  <p>Here is the HTMLcode:</p>
  
  <pre><code>&lt;form action=""&gt;
      &lt;input type="text" class="searchbox1" name="search" placeholder="Search for Brand, Store or an Item..." value="text" /&gt;
      &lt;input type="button" class="searchbox_submit1" name="submit" value="text" onClick="javascript:getSearchText();"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is the JS code:</p>
  
  <pre><code>function getSearchText() {
      var searchText = document.getElementByName("search").value;
      h_url=document.getElementById("u").value;
      var theURL = h_url+'search_all/' + deptid + '/' + searchText + '/1';
      $.ajax({
          url : theURL,
          fail: function(){
          },
          success : function() {
          },
          error:function(){
          }
      });
  }
  </code></pre>
  
  <p>Please help me to fix this.</p>