Select + onchange + php

Résolu
Voici mon code :

function refresh_div(val) {
 
      $.ajax({
            type: 'POST',
            url: '',
            data: {
                get_option: val
            },
            success: function (response) {
                alert(val);
                <?php
          $list_tick = lists_tickets('', 100);
          ?>
                $("#dataTable").load(" #dataTable > *");
            }
        });
}


et le rendu :

<select name="temps" onchange="refresh_div(this.value)">
<option value="4">4</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option
</select> Jours

....
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Statut</th>
                        <th>Source</th>
                        <th>Priorité</th>
                        <th>Catégorie</th>
                        <th>Titre</th>
                        <th>Contenue</th>
                        <th>Demandeur</th>
                        <th>Technicien</th>
                        <th>Date d'ouverture</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>ID</th>
                        <th>Statut</th>
                        <th>Source</th>
                        <th>Priorité</th>
                        <th>Catégorie</th>
                        <th>Titre</th>
                        <th>Contenue</th>
                        <th>Demandeur</th>
                        <th>Technicien</th>
                        <th>Date d'ouverture</th>
                    </tr>
                </tfoot>
                <tbody>
                    <?php
                        $list_tick = lists_tickets('',$_POST['get_option']);
                        for($j = 0; $j < count($list_tick["id"]); $j++) {   
                            echo "<tr>";
                                echo "<td>".$list_tick['id'][$j]."</td>";
                                echo "<td>".$list_tick['status'][$j]."</td>";
                                echo "<td>".$list_tick['name'][$j]."</td>";
                                echo "<td>".$list_tick['priority'][$j]."</td>";
                                echo "<td>".$list_tick['cat'][$j]."</td>";
                                echo "<td>".$list_tick['title'][$j]."</td>";
                                echo "<td>".$list_tick['desc'][$j]."</td>";
                                echo "<td>".$list_tick['deman'][$j]."</td>";
                                echo "<td>".$list_tick['techn'][$j]."</td>";
                                echo "<td>".$list_tick['dateouv'][$j]."</td>";
                            echo "</tr>";
                        }
                    ?>
                </tbody>
            </table>


Mon but c'est de recharger le tableau avec les données envoyées, sans recharger toute la page.

Je suis bloqué le tableau ne récupère pas les nouvelles tableaux. Mon tableau est généré avec le datables.boostrap4.js.

Merci par avance !

2 réponses