Advertisement
Guest User

Server-Side Internet Programming - Ajax Script

a guest
Sep 17th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement