Kód: Vybrať všetko
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var XMLOB;
if (window.XMLHttpRequest)
{
XMLOB=new XMLHttpRequest();
}
else
{
XMLOB=new ActiveXObject("Microsoft.XMLHTTP");
}
XMLOB.onreadystatechange=function()
{
if (XMLOB.readyState==4 && XMLOB.status==200)
{
document.getElementById("myDiv").innerHTML=XMLOB.responseText;
}
}
XMLOB.open("GET","subor.txt",true);
XMLOB.send();
}
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>