I am having trouble figuring out how to use the xmlHttpRequest() method and if I saw a very simple example I think I could pick it up with ease. Here is what I am picturing:
-A text area for user input
-A button that calls a javascript function
-A javascript function that uses xmlHttpRequest()
to send the value of the text area to a php page
-A php page that uses fwrite()
to log the text area value in a .txt document.
Here's some starting code if you'd like:
<html>
<head>
<script type="text/javascript">
function sendText(){
var message = document.getElementById("inputText").value;
var myRequest = new XMLHttpRequest();
// xmlhttprequest() code that I struggle with understanding.
}
</script>
</head>
<body>
<div align="center">
<textarea id"inputText"></textarea>
<br><br>
<button onclick="sendText()">
Send!
</button>
</div>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire