jukleidie
Mitglied
ajax.php
ajax_php.php
Warum funktioniert das nicht? Ich bin am verzweifeln =(
Kann mir jemand helfen?
Danke schonmal =)
Code:
<html>
<head>
<title>Meine ersten Ajax Erfahrungen</title>
<script type="text/javascript">
function doIt(){
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request = new XMLHttpRequest();
http_request.overrideMimeType('text/xml');
http_request.onreadystatechange = function(){
http_request.open('POST', 'http://www.juklei.de/a/ajax_php.php', true);
alert(http_request.responseText);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send('text=hallo');
};
}
</script>
</head>
<body>
<div id="eins" style="width: 80%; height: 80%; border: dashed 1px;">
Datensatz eintragen: <input type="text" id="text"/><input type="button" onclick="doIt();" value="Do it!" />
</div>
</body>
</html>
PHP:
<?php
$text = $_POST['text'];
echo $text;
php?>
Kann mir jemand helfen?
Danke schonmal =)
Zuletzt bearbeitet: