Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.19 KB | None | 0 0
  1.                
  2.  
  3.  
  4.    
  5.            
  6.                                                    
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                
  18.    
  19.  
  20.  
  21. <form id="productSearch" method="get" action="">
  22.     <label for="productCats">Filter by:</label>
  23.     <select id="productCats">
  24.         <option value="">ALL</option>
  25.         <option value="consulting">Consulting</option>
  26.         <option value="research">Research</option>
  27.         <option value="training">Training</option>
  28.  
  29.     </select>
  30. </form>  <!-- #productSearch -->
  31.  
  32. <div id="productSearchResults"></div>
  33.  
  34. <script type="text/javascript">
  35.     $(document).ready(function() {
  36.         var showProducts = function(cat) {
  37.             $.getJSON("/JSONContent/",
  38.                 {
  39.                     type: 'json',
  40.                     q: '%2BstructureName:product%20%2Bcategories:' + cat
  41.                 },
  42.                 function(data) {
  43.                     $('#productSearchResults').append('<ul></ul>');
  44.                     $.each(data.contentlets, function(i, contentlet) {
  45.                             $('#productSearchResults ul').append('<li>' + contentlet.title + '</li>');
  46.                     });
  47.                 }
  48.             );
  49.         };
  50.    
  51.         $('#productCats').change(function() {
  52.             var cat = $(this).val();
  53.             showProducts(cat);
  54.         });
  55.     });
  56. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement