title: Search without inputting data will result to stock up of website
body: <p>I encounter problem on on my search when i click search without inserting data  the website will stop. </p>
  
  <pre><code>$('#search-btn').on('click',function(){
      var query = $("#keyword").val();
      var query_url = "&lt;?php echo site_url('item_controller/searchItem'); ?&gt;";
  
      $.ajax({
          type:'POST',
          url: query_url,
          data:{query: $("#keyword").val()},
          dataType:'json',
          async: false,
          success:function(d){
  
              $("#example tbody").html("");
              for(i in d){
                  $("#example tbody").append("&lt;tr&gt;&lt;td style='text-align: center; color:' data-code='TRUE'&gt;" + d[i]['item_code'] + "&lt;/td&gt;&lt;td style='text-align: left' data-name='TRUE'&gt;" + d[i]['item_name'] + "&lt;/td&gt;&lt;td&gt;&lt;div style='text-align: center'&gt;&lt;input type='button' value='ADD' class='k-button' id='" + d[i]['item_code'] + "' data-item=TRUE /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;");
              }
  
          },
  
      });    
  
  });
  </code></pre>