PHP interesse |
|
Sorry, kon even geen duidelijkere titel bedenken!
Ik ben met behulp van de tutorial op SiMa met AJAX begonnen, nou werkt dit scriptje niet, en ik kan de fout niet vinden, FireBug zegt ook niks! Jullie misschien?
checkemail.html
<html>
<head><title>Check your email!</title>
<script src="server.js"></script>
<script type="text/javascript">
function mailright( ) {
var data = SERVER.Ontvangst();
if( data ) {
document.getElementById( 'truefalse' ).innerHTML = data;
}
}
</script>
</head>
<body>
<form name="emailcheck">
<input type="text" name="letter" id="letter" value="" onchange="SERVER.GETrequest( 'emailchecker.php', 'email='+this.value, mailright );" />
</form>
Your email is <span id="truefalse"></span>
</body>
</html>
<script type="text/javascript"> function mailright( ) { var data = SERVER.Ontvangst(); if( data ) { document.getElementById( 'truefalse' ).innerHTML = data; } } <input type="text" name="letter" id="letter" value="" onchange="SERVER.GETrequest( 'emailchecker.php', 'email='+this.value, mailright );" /> Your email is <span id="truefalse"></span>
emailchecker.php
<?php
$email = $_GET['email'];
if(preg_match("^(\w+@\w+(?:\.\w+)+)$", $email)) {
echo '<b style="color: green;">good<b>';
} else {
echo '<b style="color: red;">bad</b>';
}
?>
<?php $email = $_GET['email']; echo '<b style="color: green;">good<b>'; } else { echo '<b style="color: red;">bad</b>'; } ?>
server.js
Plaatscode: 5099
Alvast bedankt!
|