SHARE
TWEET

Server-Side Internet Programming - Ajax Script

a guest Sep 17th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7.     <title>AJAX</title>
  8.     <script>
  9.         function ajax1() {
  10.             var xhttp = new XMLHttpRequest();
  11.             xhttp.onreadystatechange = function() {
  12.                 if(this.readyState == 4 && this.status == 200)
  13.                     document.getElementById("res").innerHTML = this.responseText;
  14.             }
  15.             xhttp.open("GET", "ajax1.txt", true);
  16.             xhttp.send();
  17.         }
  18.         function ajax2() {
  19.             var xhttp = new XMLHttpRequest();
  20.             xhttp.onreadystatechange = function() {
  21.                 if(this.readyState == 4 && this.status == 200)
  22.                     document.getElementById("res").innerHTML = this.responseText;
  23.             }
  24.             xhttp.open("GET", "ajax2.txt", true);
  25.             xhttp.send();
  26.         }
  27.     </script>
  28. </head>
  29. <body>
  30.     .A.J.A.X.
  31.     <div style="font: size 48">
  32.         <label onmouseover="ajax1()"> A </label>
  33.         <label onmouseover="ajax2()"> B </label>
  34.     </div>
  35.     <div id="res"></div>
  36. </body>
  37. </html>
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