Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
493 B
1
Indexable
Never
<!DOCTYPE html>
<html>
  <head>
    <title>Ajax</title>
    <script type="text/javascript">
    function ajaxfunction()
    {
      var ajax = new XMLHttpRequest();
      ajax.onreadystatechange = function() 
      {
      if (this.readyState==4 && this.status == 200) 
      {
        alert(this.responseText);
      }
    };
      ajax.open("GET","text.txt",true);
      ajax.send();    
    }
  </script>
</head>

<body>
  <button onclick="ajaxfunction()">Call Ajax</button>
</body>
</html>