Primárně pro 4IM - opakování HTML+CSS+JS + základ AJAX
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
791 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Ajax</title>
</head>
<body>
<h1>AJAX demo</h1>
<!-- https://www.w3schools.com/js/js_ajax_intro.asp -->
<div id="demo">
<h2>stiskni na tlačítko pro změnu</h2>
<button type="button" onclick="loadDoc()">Změnit obsah</button>
</div>
<script>
function loadDoc() {
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("demo").innerHTML = this.responseText;
}
xhttp.open("GET","ajax.txt",true);
xhttp.send();
}
</script>
</body>
</html>