How do I get url from server like in this case?

16 views
Skip to first unread message

RAGHIB R

unread,
Jan 14, 2016, 12:25:47 AM1/14/16
to AJAX-chat
<!DOCTYPE html>
<html>
<body>

<p id="demo">Let AJAX change this text.</p>

<button type="button" onclick="loadDoc()">Change Content</button>

<script>
function loadDoc() {
  var xhttp;
  if (window.XMLHttpRequest) {
    // code for modern browsers
    xhttp = new XMLHttpRequest();
    } else {
    // code for IE6, IE5
    xhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      document.getElementById("demo").innerHTML = xhttp.responseText;
    }
  };
  xhttp.open("GET", "ajax_info.txt", true);
  xhttp.send();
}
</script>

I have copied this from the w3schools! But how do I read ajax_info.txt on my own?

Fabian Wilson

unread,
Jan 14, 2016, 8:10:51 AM1/14/16
to RAGHIB R, AJAX-chat
Hi Raghib,
This forum is for the Ajax Chat users seeking help and not for Ajax programming language alone. Please look for your answer in another forum. But if you have questions about Ajax Chat you are welcome to ask.

--
You received this message because you are subscribed to the Google Groups "AJAX-chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ajax-chat+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages