title: how we can use in Laravel Jquery onchange element in select?
body: <pre><code>&lt;script&gt;
      $('#brand_id').on('change',function(e){
          console.log(e);
          var brand_id =  e.target.value;
  
          //ajax
          $.get('/product_id?brand_id =' + brand_id, function(data));
          //success data
          $.each(data, function(upload_form, product_cat){
              $('product_category').empty();
              $('product_category').append('&lt;option value="'+ product_cat.id +'"&gt;'+ product_cat.product_hierarchy +'&lt;/option&gt;');
          });
  
      });
  </code></pre>
  
  <p></p>
  
  <p>Above is my Jquery code check this and point out me what is the problem.</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="{{action('BrandController@upload_csv')}}" method="post"&gt;
      Brand Code
      &lt;select name="brand_id" id="brand_id" Select="" class="form-control"&gt;
        &lt;option value=""&gt;--Select Brand Code--&lt;/option&gt;
        &lt;?php foreach ($brands as $row) { ?&gt;
        &lt;option value="&lt;?= $row-&gt;brand_id ?&gt;"&gt;&lt;?= $row-&gt;brand_name ?&gt;&lt;/option&gt;
  
        &lt;?php } ?&gt;
  
      &lt;/select&gt;
      Product Id
      &lt;select name="product_category" id="product_category"   Select="" class="form-control"&gt;
  
      &lt;/select&gt;
  
      Status
      &lt;select name="status" Select="" class="form-control"&gt;
        &lt;option value=""&gt;--Select Product Status--&lt;/option&gt;
  
        &lt;option value="1"&gt;Yes&lt;/option&gt;
        &lt;option value="0"&gt;No&lt;/option&gt;
  
      &lt;/select&gt;
  
      &lt;input type="hidden" name="_token" value="&lt;?= csrf_token(); ?&gt;"&gt;
      Upload Valid csv file
      &lt;input type="file" name="csv" required class="form-control"&gt;
      &lt;br/&gt;
      &lt;input type="submit" value="Upload" class="btn btn-primary"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is my form. in the form there is a select in which onchange element i want to show sub categories in next select. Below is my Route file code.</p>
  
  <p>Route::get('/product_id', function(){
      $brand_id = Input::get('brand_id');</p>
  
  <pre><code>$product_id = product_hierarchy::where('bcategory_code','=',1)-&gt;get();
  
  return Response::json($product_id);
  </code></pre>
  
  <p>});</p>