$(function(){
$(".user_login").on('touchend',function(){
var username = $("#username").val();
var password = $("#password").val();
var param = {title:'提示',text:'',callback:function(){this.remove();}}
if(!username){
param.text = "请输入用户名!";
iAlert(param);
return;
}
if(!password){
param.text = "请输入密码!";
iAlert(param);
return;
}
/*$.getJSON("localhost:8080/WBPlatform/user/login.do").then(function(obj){
console.log(obj);
});*/
$.ajax({
"url": "http://192.168.0.150/WBPlatform/user/login.do",
"data": "username="+username+"&password="+password,
"type": "POST",
"dataType": "json",
"xhrFields": {
withCredentials: true
},
"crossDomain": true,
"success": function(obj) {
if(obj.state==1){
console.log(obj.message);
location.href="center.html";
}else{
param.text = obj.message;
iAlert(param);
}
}
});
});
});
一键复制
编辑
Web IDE
原始数据
按行查看
历史