"[Violation] Added non-passive event listener to scroll-blocking 'mousewheel' event"

0

When I try to pass the value of a select to an onChange function, by clicking on the button it gives the following error in the console:

[Violation] Added non-passive event listener to scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.

ERROR CODE (page where data is searched)

<?php
//Conectando ao banco de dados
$con = new mysqli("localhost", "root", "", "tcc");
if (mysqli_connect_errno()) trigger_error(mysqli_connect_error());

//Consultando banco de dados
$qryLista = mysqli_query($con, "SELECT * FROM postagens");    
while($r = mysqli_fetch_assoc($qryLista)){
 ?>
<table id='tabela'>
<tr>
<td><?= $r['id'] ?></td>
<td><?= $r['nome'] ?></td>
<td><?= $r['rua'] ?></td>
<td><?= $r['bairro'] ?></td>
<td><?= $r['telefone'] ?></td>
<td><?= $r['descricao'] ?></td>     
<td>
<select id='sel1'>
<option value='status'><?= $r['status'] ?></option>
<option value='pendente'>Pendente</option>
<option value='recolhido'>Recolhido</option>
</select></td>
</table>

<?php 
    }


?> 

excerpt page where the javascript function is

<script src="source\jquery-3.2.1.min.js"></script>
<script>



$(document).ready(function () {
    $('.sel1').on('change', function () {
         var selecionado = $(this).val(); 
       var selecionado_id = $(this).attr('data-id'); 
        $.ajax({
           data: "id=18&selecionado=recolhido",
          type: 'post',
          url: 'status.php',
      });
  });


</script>
<script>

// REFRESH FUNCTION ON THE PAGE

        function load() {
             $("#tabela").load("getdados.php", null, function () { 
                    $(".loading-div").hide(); 
                });
        };
        $(document).ready(function () {
            load();
            setInterval(function () {
                load();
            }, 8000);
        });
    </script>
    </head>
        Bem vindo
        <?php echo $nome;?> <p>
        <?php echo $email;?><p>
        <a href="sair.php">Sair</a></p>
    <body>

    <div class ="container-fluid">
    <table class="table table-hover">
      <thead>
   <tr>
  <td>id</td>
  <td>nome</td>
  <td>rua</td>
  <td>bairro</td>
  <td>telefone</td>
  <td>materiais</td>
  <td>Status</td>
</tr>
<tbody id="tabela">

</tbody>

    

    
asked by anonymous 13.09.2017 / 04:37

1 answer

1

There are several errors in your codes.

First you are trying to access select with a selector of type class and it has not been assigned in select , there are two ways to solve this problem since you have set a id .

You can assign class to select

<select id='sel1' class='sel1'>

Or access select from the id selector by changing the javascript line:

$('.sel1').on('change', function () {

By:

$('#sel1').on('change', function () {

Another error is that you are trying to retrieve an attribute that your select does not have that is data-id .

var selecionado_id = $(this).attr('data-id'); 

To fix you should assign it.

<select id='sel1' class='sel1' data-id='<?= $r['id'] ?>'>

To learn more about seletores do jQuery , read Understanding jQuery selectors written by Thiago Belem

    
13.09.2017 / 05:26