function login(o) {
var username=$("#username").val();
var password=$("#password").val();
if(username==null||username==""){
layer.alert("用户名不能为空");
};
if(password==null||password==""){
layer.alert("密码不能为空");
}
var url='/api/login';
$.ajax({
type: "POST",
async: false,
url: url,
dataType: "json",
data:{
username:username,
password:password,
},
success:function (response) {
if(response.code==0){
window.location.href = "index.html";
}else{
layer.alert("登录失败,请重新登录");
}
},error:function (err) {
layer.alert("登录失败,请重新登录");
}
网友评论