$.ajax({
type :"POST",
url :"/doLogin",
data : $('#form').serialize(),
error :function(request) {
alert("操作失败!");
},
success :function(data) {if (data == '200') {if ($('#remember-password').attr('checked')) {var cookie = newrememberPassword();
cookie.cookieRemeber();
}
window.location.href= "/index";
}else if (data == '500') {
$('#password').val('');
$('#checkCode').val('');
$('#checkCode').attr('placeholder','');
changeImg();
$('#password').attr('placeholder','用户名或密码不正确');
$('#password').focus();
}else if (data == '401') {
$('#checkCode').val('');
$('#checkCode').attr('placeholder','验证码不正确');
changeImg();
}else if(data == '501'){
layui.use(['laypage', 'layer'], function(){var laypage =layui.laypage
,layer=layui.layer;
layer.open({
type:2, //类型,解析url
closeBtn: 1, //关闭按钮是否显示 1显示0不显示
title: '密码修改', //页面标题
shadeClose: true, //点击遮罩区域是否关闭页面
shade: 0.3, //遮罩透明度
area: ['650px', '300px'], //弹出层页面比例
content: '/userInfo/password' //弹出层的url
});
});
}else{if(data == '10'){
$('#username').val('');
$('#checkCode').val('');
$('#password').val('');
$('#username').attr('placeholder','用户已删除,无法登陆');
}else if(data == '11'){
$('#username').val('');
$('#checkCode').val('');
$('#password').val('');
$('#username').attr('placeholder','用户暂未通过审核');
}else if(data == '12'){
$('#username').val('');
$('#checkCode').val('');
$('#password').val('');
$('#username').attr('placeholder','用户未能通过审核');
}else if(data == '14'){
$('#username').val('');
$('#checkCode').val('');
$('#password').val('');
$('#username').attr('placeholder','用户已被禁用');
}else if(data == '3'){
$('#username').val('');
$('#checkCode').val('');
$('#password').val('');
$('#username').attr('placeholder','用户已被禁用');
}
}
}
});