title: Retrieve subcategory selection option via Ajax based on category selection
body: <p>like title says, I'm trying to populate one selection element based from selection of another. </p>
  
  <p>I've come up with this code, which works when I'm retrieving records from db with live search but something is not firing here, so help would be appreciated:</p>
  
  <pre><code>$(document).ready(function() {  
  
      function search() {
          var query_value = $('select#category_id').val();
  
          if(query_value !== ''){
              $.ajax({
                  type: "POST",
                  url: "ajax_php/subcategory.php",
                  data: { category: query_value},
                  cache: false,
                  success: function(html){
                      $("select#subcateogry").html(html);
                  }
              });
          }return false;    
      }
  
  });
  </code></pre>
  
  <p>PHP code in short, I'm catching post variable, doing query and echoing:</p>
  
  <pre><code>echo "&lt;option value='".$result['id']."'&gt;".$result['subcategory']."&lt;/option&gt;";
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;p&gt;
      &lt;label&gt;Item Subcategory:&lt;/label&gt;
      &lt;select id='subcategory' name='subcategory'&gt;
  
      &lt;/select&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Is there any obvious mistake that I'm missing here?</p>
  
  <p>Thanks</p>