title: Jquery Chosen Select plugin doesn't Work in PHP Ajax response
body: <p>I have two chosen select box for fetching values from MYSQL DB</p>
  
  <p>When No-1 Select box change then No-2 select box generate from AJAX response.</p>
  
  <p>Chosen Plugin in No-1 work perfectly. But When No-2 select box generate from ajax then chosen plugin doesn't work in No-2 select box.</p>
  
  <p><strong>Main.PHP</strong></p>
  
  <pre><code>         &lt;div class="control-group"&gt;
            &lt;label for="textfield" class="control-label"&gt;Category&lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                &lt;div class="controls"&gt;
                &lt;select name="category" id="category" multiple="multiple" class="chosen-select input-medium" required onchange="showSubCat(this.value)"&gt;
                  &lt;option value='1'&gt;Option 1&lt;/option&gt;
                  &lt;option value='2'&gt;Option 2&lt;/option&gt;
                &lt;/select&gt;
                &lt;input type='hidden' value='' id='categoryId' name='categoryId'&gt;
               &lt;/div&gt;
              &lt;/div&gt;  
  
              &lt;div class="control-group"&gt;
                &lt;label for="textfield" class="control-label"&gt;Sub Category&lt;/label&gt;
                &lt;div class="controls"&gt;
                &lt;select name="subCat_2" id="subCat_2" multiple="multiple" class="chosen-select input-large"&gt;
                  &lt;option value=""&gt;--- Select Sub Category---&lt;/option&gt;
                &lt;/select&gt;
               &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS CODE :</strong></p>
  
  <pre><code>var xmlhttp;
          function showSubCat(str){
  
              if( $('#category :selected').length &gt; 0){
              //build an array of selected values
              var selectednumbers = [];
              $('#category :selected').each(function(i, selected) {
                  selectednumbers[i] = $(selected).val();
              });
              }
              //alert(selectednumbers);   
              document.getElementsByName('categoryId')[0].value = selectednumbers;
              if (str==""){
                  document.getElementById("subCat_2").innerHTML="";
                  return;
              }
              if (window.XMLHttpRequest){
                  xmlhttp=new XMLHttpRequest();
              }
              else{
                  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
              xmlhttp.onreadystatechange=function(){
                  if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){
                      document.getElementById("subCat_2").innerHTML=xmlhttp.responseText;
                      //alert(xmlhttp.responseText);
                      console.log(xmlhttp.responseText);
                  }
              }
              xmlhttp.open("GET","MYurl.php?catId="+selectednumbers,true);
              xmlhttp.send();
          }
  </code></pre>
  
  <p><strong>AJAX.PHP</strong></p>
  
  <pre><code>echo "&lt;option value=''&gt;--- Select Sub Category --- &lt;/option&gt;";
  
  
          $sql="SELECT field FROM tableName WHERE condition;
          $result = mysql_query($sql) or die('MySql Error' . mysql_error());
          while($row = mysql_fetch_array($result)){
  
              echo "&lt;option value='1'&gt; ----- Sub Option 1&lt;/option&gt;";
  
  
  }
  </code></pre>
  
  <p>Let me know what i have done Wrong..??</p>