Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.   </head>
  5.  
  6.   <body>
  7.     <input id="c" type="text" onkeypress="processar()">
  8.     <p id="p1">Resultado:</p>
  9.  
  10.     <script>
  11.       function processar() {
  12.         var xhttp;
  13.         xhttp = new XMLHttpRequest();
  14.  
  15.         xhttp.onreadystatechange = function() {
  16.           var f1 = this.readyState == 4;
  17.           var f2 = this.status == 200;
  18.  
  19.           if (f1 && f2) {
  20.            var p = document.getElementById('p1');
  21.             p1.innerHTML = this.responseText;
  22.           }
  23.         };
  24.  
  25.         var k = document.getElementById('c');
  26.         var digitado = k.value;
  27.  
  28.         var url = "bua.php?paulo=" + digitado;
  29.         xhttp.open("GET", url, true);
  30.         xhttp.send();
  31.       }
  32.     </script>
  33.   </body>
  34. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement