Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<title>AJAX-Beispiel 2</title>
<script>
function laden(eingabe) {
let ajaxObj = new XMLHttpRequest();
ajaxObj.onreadystatechange = ausgeben;
ajaxObj.open("GET", "speichern.php?inhalt=" + eingabe, true);
ajaxObj.send();
}
function ausgeben(){
if (this.readyState == 4 && this.status == 200) {
document.getElementById("eingabe").value = this.responseText;
}
}
</script>
<body>
<h1>Text an Server senden</h1>
Eingabe: <input id = "eingabe"><br><br>
<button type="button" onclick="laden(document.getElementById('eingabe').value)">Inhalt speichern</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment