SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ...
  2.  
  3. $resultados = [];
  4. while ($regist = $regists->fetch()) {
  5.     $resultados[] = [
  6.         'ci'       => $regist['ci'],
  7.         'nombre'   => $regist['name'],
  8.         'apellido' => $regist['second_name'],
  9.         'email'    => $regist['email'],
  10.     ];
  11. }
  12.  
  13. echo json_encode($resultados);
  14.      
  15. $(document).ready(function() {
  16.     $('#frm').on('submit', function (e) {
  17.         e.preventDefault(); // Previene el envío del formulario
  18.  
  19.         // Variables
  20.         var $form = $(this);
  21.         var data = $form.serialize();
  22.         var url = $form.attr('action');
  23.  
  24.         // AJAX
  25.         $.post(url, data, function (response) {
  26.             console.log(response); // Acá harás lo que quieras con la respuesta
  27.         }, 'json');
  28.     });
  29. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top