title: Laravel 5.1 Dependent drop down list using Database....and Jquery
body: <p>Please somebody help to manipulate the dependent dropdown list using laravel 5.1....
  <strong>this is my main category</strong></p>
  
  <pre><code>&lt;div class="form-group col-md-10"&gt;
         {!! Form::label('Main Cateogry') !!}
         {!! Form::select('category', (['0' =&gt; 'Select Category'] + $category), null, ['class' =&gt; 'form-control required', 'id'=&gt;'cat', 'data-url'=&gt;'/admin/dropdown']) !!}
  
  &lt;/div&gt;
  &lt;div class="form-group col-md-10"&gt;
         {!! Form::label('Sub Category Name') !!}
         {!! Form::select('subcategory', (['0'=&gt;'Select Sub Category'] + $sub_cat), null, ['class'=&gt;'form-control','id'=&gt;'subcat']) !!}
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>This sub **category</strong> (loadcat.blade.php)**</p>
  
  <pre><code>@foreach($sub_cat as $sub)
  &lt;option value="{{ $sub-&gt;id}}"&gt;{{$sub-&gt;sub_cat_name}}&lt;/option&gt;
  @endforeach
  
  &lt;script&gt;
            $(document).ready(function($){
               $('#cat').change(function(){
                $.get($(this).data('url'),
                 { option: $(this).val() },
                   function(data) {
                     var subcat = $('#subcat');
                     subcat.empty();
                     $.each(data, function(index, element) {
                     subcat.append("&lt;option value='"+ element.id +"'&gt;" + element.name + "&lt;/option&gt;");
                  });
                });
              });
           });
   &lt;/script&gt;
  </code></pre>