php+jquery+ajax无刷新验证用户名
php+jquery+ajax无刷新验证用户名是否已存在,要一个尽量短的例子。
------解决方案--------------------
今天不忙,玩玩
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("#getjson").bind("click",function(){
$.ajax({
type: "POST",
url: "/index.php",
data: "name="+$("#username").val(),
success: function(msg){
alert(msg);
}
});
});
})
</script>
</head>
<body>
<input type="text" id="username" /><button id="getjson">获取</button>
</body>
</html> <div class="clear">
</div>










