<!DOCTYPE html>
<html>
<head>
<title>Регистрация</title>
<meta http-equiv="Content-Type" Content="text/html; Charset=Windows-1251">
<script type="text/javascript">
function registration() {
var name = document.getElementsByName( 'login' )[0].value;
var password = document.getElementsByName( 'password' )[0].value;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open( "POST", "save_user.php", true );
xmlhttp.onreadystatechange = function(){
if ( xmlhttp.readyState == 4 ) {
if ( xmlhttp.status >= 200 && xmlhttp.status < 300 || xmlhttp.status === 304 ) {
document.body.appendChild( document.createTextNode( xmlhttp.responseText ) ) ;
}
} else {
document.body.appendChild(document.createTextNode( 'Loading...' ) ) ;
}
}
var params = 'name='+encodeURIComponent( name )+'&password='+encodeURIComponent( password );
xmlhttp.setRequestHeader( 'Content-Type','application/x-www-form-urlencoded' );
xmlhttp.send( params );
return false;
}
</script>
</head>
<body>
<h2>Регистрация</h2>
<form method="post" enctype="application/x-www-form-urlencoded" onsubmit="return registration()">
<p>
<label>Ваш логин<br></label>
<input name="login" type="text" size="15" maxlength="15">
</p>
<p>
<label>Ваш пароль:<br></label>
<input name="password" type="password" size="15" maxlength="15">
</p>
<p>
<input type="submit" name="submit" value="Зарегистрироваться">
</p>
</form>
</body>
</html>