title: Select onChange Table blade view
body: <p>UPDATE : now when i change the poule_id i get a blank table with nothing inside , when i go directly to the url like : </p>
  
  <p><a href="https://mydomaine.eu/go/public/competition/search/equipes?poule_id=2" rel="nofollow noreferrer">https://mydomaine.eu/go/public/competition/search/equipes?poule_id=2</a></p>
  
  <p>i get :<br>
  table   "\n\n\n\n\n"</p>
  
  <p>I try to make a function who change the result of my blade table who display equipes(teams) with a select box but nothing happen at the moment i don't know where i did a mistake , it's maybe in the javascript code </p>
  
  <p>Hope someone could help to fix that , thanks a lot in advance </p>
  
  <p>I try to change my table depending on poule_id with a select box like this : </p>
  
  <pre><code>&lt;select id="poule"&gt;
      @foreach($select_poules as $select_poule)
          &lt;option value="{{$select_poule-&gt;id}}"&gt;{{$select_poule-&gt;lb_poule}}&lt;/option&gt;
      @endforeach
  &lt;/select&gt;
  </code></pre>
  
  <p>My table contain the teams who depend on a poule_id : </p>
  
  <p></p>
  
  <pre><code>@foreach($equipes as $equipe)
    &lt;tr&gt;
      &lt;td&gt;
        &lt;a href="{!! route('club.show', $equipe-&gt;equipe-&gt;structure-&gt;id) !!}"&gt;{{$equipe-&gt;equipe-&gt;structure-&gt;nom_structure}}&lt;/a&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;a href="{!! route('equipe.show', $equipe-&gt;equipe-&gt;id) !!}"&gt;{{$equipe-&gt;equipe-&gt;lb_equipe}}&lt;/a&gt;
      &lt;/td&gt;
      &lt;td&gt;
        {!! Form::text('nb_bonus') !!}
      &lt;/td&gt;
    &lt;/tr&gt;
  @endforeach
  </code></pre>
  
  <p>Here my controller : </p>
  
  <pre><code>public function searchEquipes(Request $request)
  {
  
      if ($request-&gt;has('poule_id')) {
  
          $equipes = EquipePoule::where('poule_id' , $request-&gt;poule_id)-&gt;get();
  
          $competition = Compet::where('id' , 1)-&gt;first();
  
          $categorie_compet = CategorieCompet::pluck('lb_categorie_compet' , 'id');
  
          $categorie_age = CatgEquipe::pluck('lb_catg_equipe' , 'id');
  
          $structure_rattachement = Structure::select('num_structure', 'nom_structure' , 'id')
              -&gt;where('type_structure_id' , '1')
              -&gt;orWhere('type_structure_id' , '2')
              -&gt;orWhere('type_structure_id' , '3')
              -&gt;get()
              -&gt;mapWithKeys(function($i) {
                  return [$i-&gt;id =&gt; $i-&gt;num_structure.' - '.$i-&gt;nom_structure];
              });
          $poules = Poule::where(['compet_id' =&gt; $competition-&gt;id])-&gt;get();
  
          $rencontres = Rencontre::where(['compet_id' =&gt; $competition-&gt;id])-&gt;orderBy('dt_rencontre' , 'DESC')-&gt;get();
  
          $designations = RencontreOfficiel::where(['compet_id' =&gt; $competition-&gt;id])-&gt;get();
  
          $classements = Classement::where(['compet_id' =&gt; $competition-&gt;id])-&gt;orderBy('nb_point_classement' , 'DESC')-&gt;get();
  
          $equipe_to_select = Equipe::select('lb_equipe', 'structure_id' , 'catg_equipe_id' ,'id')
              -&gt;get()
              -&gt;mapWithKeys(function($i) {
                  return [$i-&gt;id =&gt; $i-&gt;lb_equipe.' - '.$i-&gt;structure-&gt;nom_structure.' - ' .$i-&gt;catg_equipe-&gt;lb_catg_equipe];
              });
  
          $stade = Stade::select('lb_nom', 'ville_stade' ,  'cd_post_stade' ,  'id')
              -&gt;get()
              -&gt;mapWithKeys(function($i) {
                  return [$i-&gt;id =&gt; $i-&gt;lb_nom.' - '.$i-&gt;ville_stade.' - '.$i-&gt;cd_post_stade];
              });
  
  
  
          $find_equipes = $competition-&gt;equipes;
  
          $domicile = $find_equipes-&gt;mapWithKeys(function ($i) {
              return [$i-&gt;id =&gt; $i-&gt;lb_equipe.' - '.$i-&gt;structure-&gt;nom_structure.' - ' .$i-&gt;catg_equipe-&gt;lb_catg_equipe];
          });
  
  
          //ON AFFICHE QUE LES EQUIPES ENREGSITRER DANS LE COMPETITION
          $find_equipes = $competition-&gt;equipes;
          $visiteur = $find_equipes-&gt;mapWithKeys(function ($i) {
              return [$i-&gt;id =&gt; $i-&gt;lb_equipe.' - '.$i-&gt;structure-&gt;nom_structure.' - ' .$i-&gt;catg_equipe-&gt;lb_catg_equipe];
          });
  
          $select_poules = Poule::where('compet_id' , 1)-&gt;get();
  
          $journees = Journee::where('compet_id' , 1)-&gt;get();
  
          $journee_to_select = Journee::where('compet_id' , 1)-&gt;pluck('nm_journee' , 'id');
  
  
          return response()-&gt;json([
  
              'table' =&gt; view("competitions/show", compact('equipes' , 'competition' , 'categorie_age' , 'categorie_compet' , 'classements' , 'equipe_to_select' , 'structure_rattachement' , 'poules' , 'select_poules' , 'journee_to_select' , 'journees' , 'rencontres', 'designations' , 'stade', 'domicile' , 'visiteur'))-&gt;render(),
  
          ]);
  
      }else {
  
          echo 'on trouve rien ';
      }
  </code></pre>
  
  <p>Here my javascript : </p>
  
  <pre><code>&lt;script&gt;
      $('#poule').change(function () {
          $.ajax({
              type: 'GET',
              dataType: "json",
              url : 'search/equipes/',
              data : {
                  poule_id : document.getElementById('poule').value
              },
              success:function(data){
                  $('#equipes').html(data.table);
              },
          });
      });
  &lt;/script&gt;
  </code></pre>