Advertisement
fabioceep

AJAX: Pesquisa ID

Jun 22nd, 2020
1,245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pt-br">
  3. <head>
  4.     <meta charset="utf-8">
  5.     <title> Cadastro de Pessoas </title>
  6.     <link rel="stylesheet" href="estilo.css">
  7.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  8. </head>
  9. <body>
  10.     <script>
  11.         $(document).ready(function(e){
  12.             $("#search").keyup(function(){
  13.                 $("show_up").show();
  14.                 var text = $(this).val();
  15.                 $.ajax({
  16.                     type: 'GET',
  17.                     url: 'pesquisa.php',
  18.                     data: 'txt='+ text,
  19.                     success: function(data){
  20.                         $("#show_up").html(data);
  21.                     }
  22.                 });
  23.             })
  24.         });
  25.     </script>
  26.     <input type="text" name="names" id="search" />
  27.     <div id="show_up"></div>
  28.  
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement