日期:2014-05-16  浏览次数:20511 次

jQuery+ajax 进入后台系统

$(document).ready(function(){
	$("#submitButton").live("click",function(){//进入后台系统
		var checkInfo=$("#checkInfo");
		var userName=$("#administrator").val();
		var password=$("#password").val();
		var checkCode=$("#checkCode").val();
		if(userName==""){
			checkInfo.html("").append("用户名不能为空!");
			return false;
		}else if(password==""){
			checkInfo.html("").append("密码不能为空!");
			return false;
		}else if(checkCode==""){
			checkInfo.html("").append("验证码不能为空!");
			return false;
		}else{
			var submitForm=$("#submitForm").serialize();
			$.post("admin_enterSystem.action",submitForm,function(data){
				var status=data.status;
				if(status==1){
					checkInfo.html("").append("验证码错误!");
				}else if(status==2){
					checkInfo.html("").append("用户名和密码错误 !");
				}else if(status==4){
					checkInfo.html("").append("管理员被锁定 !");
				}else{
					window.location.href="admin_index.jsp";
				}
			},"json");
		}
	});
});
?