title: Dependent dropdown not showing values while editing?
body: <p>I have a form in that i have two dropdowns main category and sub category and both of them are populated by using ajax. the second dropdown(sub category) is disabled at first when the user selects main category dropdown then second dropdown is enabled and all the corresponding values are populated in it.(Like if fruits is selected then in subcategory dropdown will be populated with mango and apple) this all works fine till here.</p>
  <p><strong>Now the issue is when i go to the listing page and try to edit all the fields in the form is populated with previous values except sub category dropdown.</strong></p>
  <p>ex:- in edit main category dropdown will fetch fruits but sub category dropdown which should contain mango is empty.</p>
  <p>please help me regarding this.</p>
  <p>I'll add my ajax below to show how i am trying to achieve this.</p>
  <p><strong>To populate main category dropdown which is working</strong></p>
  <pre><code>
  $.ajax
  ({
      url: &quot;listmaindropdown&quot;,
      type: &quot;GET&quot;,
      dataType: &quot;json&quot;,
      success: function(loadmaindropdown)
      {
          var aaaa = $(&quot;#home_main_cat_dropdown_id&quot;);
  
          $.each(loadmaindropdown, function(index,category)
          {
              $(&quot;&lt;option&gt;&quot;).val(category.m_id).text(category.main_category).appendTo(aaaa);
          });
                      
          if(${product != null})
          {   
  
              $('option[value=&quot;${product.home_main_category}&quot;]').prop(&quot;selected&quot;,&quot;selected&quot;);  // its working here
          }
      },
  })
  
  </code></pre>
  <p><strong>For populating sub category dropdown</strong></p>
  <pre><code>
  $(&quot;#home_main_cat_dropdown_id&quot;).change(function(value) 
  {
      var main_category_values = this.value;
          
      $.ajax
      ({
          url: &quot;listsubdropdown&quot;,
          type: &quot;GET&quot;,
          data: &quot;s_id=&quot; + main_category_values ,
          dataType: &quot;json&quot;,
          success: function(loadsubdropdown)
          {
              var bbbb = $(&quot;#home_sub_cat_dropdown_id&quot;);
      
              bbbb.find('option').remove();
          
              $.each(loadsubdropdown, function(index,category)
              {
                  $(&quot;&lt;option&gt;&quot;).val(category.m_id).text(category.sub_category).appendTo(bbbb);
              });
  
              if(${product != null})
              {
                              // Here it's not working
                  $('#home_sub_cat_dropdown_id option[value=&quot;${product.home_sub_category}&quot;]').prop(&quot;selected&quot;,&quot;selected&quot;);
              } 
          },
      });
  });
  
  </code></pre>