Javascript examples for Language Basics:XMLHttpRequest
Getting data from a website using XMLHttpRequest
<html> <head> <script type="text/javascript"> function go(){/*from w ww . j av a 2 s . c o m*/ var xhr = new XMLHttpRequest(); xhr.open("GET", "https://your server dot com", false); xhr.onreadystatechange = function(){ if (xhr.readyState == 4) { document.write(xhr.responseText); } else { document.write("nope"); } } xhr.send();} </script> </head> <body onload="go()"> </body> </html>