Last active
August 3, 2020 08:37
-
-
Save BMU-Verlag/d8acb74ea5ce920ed179c524ad858051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>AJAX-Beispiel 1</title> | |
<script> | |
function laden() { | |
let ajaxObj = new XMLHttpRequest(); | |
ajaxObj.onreadystatechange = ausgeben; | |
ajaxObj.open("GET", "daten.txt", true); | |
ajaxObj.send(); | |
} | |
function ausgeben(){ | |
if (this.readyState == 4 && this.status == 200) { | |
document.getElementById("ausgabe").innerHTML = this.responseText; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Nachrichten anzeigen</h1> | |
<textarea id="ausgabe" style = "height:150px; width:150px;"> | |
</textarea><br><br> | |
<button type="button" onclick="laden()">Inhalt anzeigen</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment