title: Multiple checked search result filter using AJAX
body: <p>In my traveling website I want to filter the search result using multiple check boxes. Currently my code is working as follows. </p>
  
  <p>If I check "Near Airport", it will show only the hotels with the data tag "airport". But when I want to filter the hotels which are near to both the air port and the shopping district at the same time,  it will not work. It shows the list of hotels which have the data tag "airport" OR "shopping". I want to change it to list the hotels which have both data tags "airport" AND "shopping".</p>
  
  <p>Screenshot of the web site <a href="http://prntscr.com/c49csj" rel="nofollow">http://prntscr.com/c49csj</a></p>
  
  <p><strong>Code in Context</strong></p>
  
  <pre><code>$(document).ready(function(){
      $('.category').on('change', function(){
        var category_list = [];
        $('#filters :input:checked').each(function(){
          var category = $(this).val();
          category_list.push(category);
        });
  
        if(category_list.length == 0)
          $('.resultblock').fadeIn();
        else {
          $('.resultblock').each(function(){
            var item = $(this).attr('data-tag');
            var itemarr = item.split(',');
            $this = $(this);
            $.each(itemarr,function(ind,val){
              if(jQuery.inArray(val,category_list) &gt; -1){
                $this.fadeIn('slow');
                return false;
              }
              else
                $this.hide();
            });
          });
        }   
      });
    }); 
  </code></pre>