27 lines
702 B
HTML
27 lines
702 B
HTML
<!DOCTYPE html>
|
|
<html> <!-- urlget.html -->
|
|
<head>
|
|
<title>Asynchronous Communication Example</title>
|
|
</head>
|
|
<body style='text-align:center'>
|
|
<h1>Loading a web page into a DIV</h1>
|
|
<div id='info'>This sentence will be replaced</div>
|
|
|
|
<script>
|
|
let nocache = "&nocache=" + Math.random() * 1000000
|
|
let XHR = new XMLHttpRequest()
|
|
|
|
XHR.open("GET", "http://127.0.0.1/18/urlget.php?url=news.com" + nocache, true)
|
|
XHR.send()
|
|
|
|
XHR.onreadystatechange = function()
|
|
{
|
|
if (this.readyState == 4 && this.status == 200)
|
|
{
|
|
document.getElementById("info").innerHTML = this.responseText
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|