Refresh options from a select that is built by the database without refreshing the page

0

My question is as follows, I have a select that your options are built from the data in the database:

<select id="cCoo" name="tCoo">
  <option style="font-style: italic" id="dsb" disabled elected>Selecione...</option>
  <?php
                include('../configBD.php');
                $sql = "select * from coordenador";
                $result = mysqli_query($conexao, $sql) or die(mysqli_error());
                while ($dados = mysqli_fetch_array($result)){
                    $codigo = $dados['idCoo'];
                    $nome = $dados ['tNomCoo'];
                    echo "<option value='$codigo'>$nome</option>";
                }
                ?>
</select>

The insertion of new data is done from a button on the same page that opens a popup and the user can register a new coordinator as in the example below.

Let'ssupposethattheuserregistersanewcoordinator,closestheregistrationpageandneedstoselectthecoordinatorhehasjustinsertedinthedatabase.Theproblemisexactlythis...TorefreshtheoptionsIputarefreshbuttonthere,andIneedafunctionthatrefreshtheoptions,thatis,withouttheuserhavingtorefreshtheentirepagecausingwhathehadfilledupifyoumissit.

    
asked by anonymous 12.12.2018 / 23:21

0 answers