Home | History | Annotate | Download | only in data
      1 <html>
      2 <head>
      3 <script>
      4 var request_success = false;
      5 
      6 function OnLoad() {
      7   var request = new XMLHttpRequest();
      8   request.open("GET", "title1.html", false);
      9   request.send("");
     10 
     11   var my_div = document.getElementById("my_div");
     12   if (request.readyState == 4 && request.status == 200) {
     13     request_success = true;
     14     my_div.innerHTML = "Got a successful response: " + request.responseText;
     15   } else {
     16     my_div.innerHTML = "Request failed: ready state=" + request.readyState +
     17                        " status=" + request.status;
     18  }
     19 }
     20 
     21 function DidSyncRequestSucceed() {
     22   return request_success;
     23 }
     24 
     25 </script>
     26 </head>
     27 <body onload="OnLoad();">
     28 This page sends a synchronous XMLHttpRequest.
     29 <br><br>
     30 <div id="my_div"></div>
     31 </body>
     32 </html>
     33