title: Return data AJAX PHP
body: <p>By defaut, when my system loads some data is filtered in my db and shown to the user. But my doubt is how can I call AJAX to filter some new data, and return it, changing the default values that are already set on my variables.</p>
  
  <blockquote>
    <p>This is my AJAX call:</p>
  </blockquote>
  
  <pre><code> $("#botao-filtrar").click(function(){
    $(".mask-loading").fadeToggle(1000);
    $.ajax({
      url: 'datacenter/functions/filtraDashboardGeral.php',
      type: 'POST',
      data: {rede: $("#dropdown-parceria").val()},
    })
    .done(function(resposta){
      console.log(resposta);
    })
    .always(function(){
      $(".mask-loading").fadeToggle(1000);
    })
  });
  </code></pre>
  
  <blockquote>
    <p>And this is what I got from trying to filter some data to return it,
    but nothing worked:</p>
  </blockquote>
  
  <pre><code>&lt;?php
      require_once('../../includes/conecta.php');
  
      $rede = $_POST['rede'];
  
      function buscaDados($conexao){
          $dados = array();
  
          $resultado = mysqli_query($conexao, "SELECT * FROM evolucao_originacao WHERE rede = {$rede}");
  
          while($valores = mysqli_fetch_assoc($resultado)){
              array_push($dados, $valores);
          }
      }
  </code></pre>
  
  <p>Any idea? </p>
  
  <p>Thanks!</p>