JSONObject jsonObject = new JSONObject();
if(byEntity == null){
jsonObject.put("res", 0);
}else{
request.getSession().setAttribute("role", 3);
jsonObject.put("res", 1);
}
}else{
}
return jsonObject.toString();
form.on('submit(login)', function(data) {
$.ajax({
type : "post",
url : "${ctx}/login/toLogin",
data : data.field,
dataType:"json",
success : function(data) {
var res = data.res;
if (res == 0){
layer.msg('用户名或者密码错误!');
}else if (res == 2){
layer.msg(data.msg);
}else{
layer.msg('登录成功!');
window.location.href = ctx+"/login/index"
}
},