<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ajax1</title>
<script src="jquery.js"></script>
<style>
div{
width:600px;
height:400px;
border:solid 1px #ccc;
color:#f00;
}
</style>
</head>
<body>
<input type="text" name="username" id="username" />
<input type="button" value="检验" />
<div></div>
<script>
$('input[type=button]').click(function(){
//alert(1);
$.get('process.php',{'username':$('#username').val()},function(data){
//alert(data);
$('div').html(data);
});
});
</script>
</body>
</html>
<?php
header('Content-type:text/html;charset=utf-8');
//echo "Hello world!";
$username = $_GET['username'];
if($username=='admin'){
echo "用户名不能是admin";
}else if($username==''){
echo "用户名不能为空";
}else{
echo "用户名可以注册";
}
?>