Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created August 3, 2020 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/4044461d26df6d70591cab6b4e0ca643 to your computer and use it in GitHub Desktop.
Save BMU-Verlag/4044461d26df6d70591cab6b4e0ca643 to your computer and use it in GitHub Desktop.
<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