Guest User

Untitled

a guest
Aug 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h2>Using the XMLHttpRequest object</h2>
  6.  
  7. <button type="button" onclick="loadXMLDoc()">Change Content</button>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. function loadXMLDoc() {
  13. var xhttp = new XMLHttpRequest();
  14. xhttp.onreadystatechange = function() {
  15. if (this.readyState == 4 && this.status == 200) {
  16. document.getElementById("demo").innerHTML =
  17. this.responseText;
  18. }
  19. };
  20. xhttp.open("GET", "notes.txt", true);
  21. xhttp.send();
  22. }
  23. </script>
  24.  
  25. </body>
  26. </html>
Add Comment
Please, Sign In to add comment