Dropdown with Ajax

Asked

Viewed 38 times

0

Hello, I am doing a Dropdown with the database and I would like to use ajax to update a table, I confess that I have a difficulty in JS, I would like a help and/ or a north for this. Grateful

<!-- Profile Image -->
<div class="box box-primary">
  <div class="box-body box-profile">
    <img class="profile-user-img img-responsive img-circle" src="../dist/img/profile/'. $id .'.png" alt="User profile picture">

    <h3 class="profile-username text-center">'. $nome .'</h3>

    <p class="text-muted text-center">Ramal: '. $id .'</p>

    <ul class="list-group list-group-unbordered">
      <li class="list-group-item">
        <b>Nivel de acesso: </b> <a class="pull-right">'. $nvAcess .'</a>
      </li>
    </ul>
    <a class="pull-right image" href="#">
      <i class="fa fa-edit">Editar</i>
    </a>
  </div>
  <!-- /.box-body -->
</div>
<!-- /.box -->


<label>Users</label> </br>
<select class="form-control select2" style="width: 100%;" id="user">
  <?php                 $conn=mysqli_connect("192.168.0.2","root","Kt6v75dX","spa") or die("ERRO AO CONECTAR");
$query = "SELECT id,nome,nivel_de_acesso,senha FROM usuarios";

$query = mysqli_query($conn,$query);

$reg = mysqli_fetch_array($query);
while($reg == 0){

}

while($reg != 0){
   $id = $reg['id'];
   $nome = $reg['nome'];
   $nvAcess = $reg['nivel_de_acesso'];
   $pass = $reg['senha'];

   echo'<option value="'.$id.'">'. $nome .'</option>';

   $reg = mysqli_fetch_array($query);
}
?>
</select>

  • How so update a table? Do you want to receive dropdown items via ajax or want to popular the table via ajax? If it is to feed the bank, what information would be, etc?

  • We’re missing information so we can help you. put prints and relevant parts of your code, the interesting thing is also that you understand what your question is so that you can pass on.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.