ajax判断用户名是否存在

复制代码
$(function (){
		$("#txtEmail").blur(function(){
			var xhr;
			if(window.ActiveXObject){
				xhr=new ActiveXObject("Microsoft.XMLHTTP");
			}else{
				xhr=new XMLHttpRequest();
			}
			xhr.open("post","${pageContext.request.contextPath}/user/user_checkEmail");
			xhr.setRequestHeader("content-type","application/x-www-form-urlencoded");
			xhr.send("u.email="+$("#txtEmail").val());
			//滚动进度条出现
			$("#sig").attr("src","${pageContext.request.contextPath}/registerImg/load.gif").show();
			xhr.onreadystatechange=function(){
				if(xhr.readyState==4&&xhr.status==200){
					var ret=xhr.responseText;
					if("ok"==ret){
						//对勾显示
						$("#sig").attr("src","${pageContext.request.contextPath}/registerImg/ok.gif");
					}else{
						$("#sig").attr("src","${pageContext.request.contextPath}/registerImg/error.jpg");
					}
				}
			};
		});






		
		    请填写您的Email地址:
						     class="text_input" />
			     
				

请填写有效的Email地址,在下一步中您将用此邮箱接收验证邮件。

   

你可能感兴趣的:(ajax,判断用户名,json,xhr,存在,Ajax)