IDEA后台执行日志
DEBUG [http-nio-8080-exec-8] - PooledDataSource forcefully closed/removed all connections.
DEBUG [http-nio-8080-exec-8] - Opening JDBC Connection
DEBUG [http-nio-8080-exec-8] - Created connection 1075980333.
DEBUG [http-nio-8080-exec-8] - Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4022282d]
DEBUG [http-nio-8080-exec-8] - ==> Preparing: select * from users where userName = ? and userPassword = ?
DEBUG [http-nio-8080-exec-8] - ==> Parameters: addd(String), G@@(String)
DEBUG [http-nio-8080-exec-8] - <== Total: 0
绯荤粺寮傚父
close database
DEBUG [http-nio-8080-exec-8] - Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4022282d]
DEBUG [http-nio-8080-exec-8] - Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4022282d]
DEBUG [http-nio-8080-exec-8] - Returned connection 1075980333 to pool.
database is closed
select resultnull
DEBUG [http-nio-8080-exec-8] - Using 'application/json', given [application/json, text/javascript, /;q=0.01] and supported [application/json, application/*+json]
DEBUG [http-nio-8080-exec-8] - Nothing to write: null body
DEBUG [http-nio-8080-exec-8] - Completed 200 OK
浏览器控制台日志
{readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}
abort: ƒ (e)
always: ƒ ()
complete: ƒ ()
done: ƒ ()
error: ƒ ()
fail: ƒ ()
getAllResponseHeaders: ƒ ()
getResponseHeader: ƒ (e)
overrideMimeType: ƒ (e)
pipe: ƒ ()
progress: ƒ ()
promise: ƒ (e)
readyState: 4
responseText: ""
setRequestHeader: ƒ (e,t)
state: ƒ ()
status: 200
statusCode: ƒ (e)
statusText: "parsererror"
success: ƒ ()
then: ƒ ()
[[Prototype]]: Object
Ajax请求代码
function admin_login(){
var username = $.trim($("#username").val());
var password = $.trim($("#userpassword").val());
if(username === ""){
alert("请输入用户名");
return false;
}else if(password === ""){
alert("请输入密码");
return false;
}
//开始传递到后端校验
var data= {userName:username,userPassword:password};//userName、userPassword必须与后端的接收变量名一致
$.ajax({
type:"POST",
url:'dologin',
data:data,
dataType:'json',
/*success: onSuccess, //请求成功回调方法
error: onError //请求失败回调方法*/
success:function(data){
//alert(msg);
if(data===null){
window.alert("用户名或密码错误!")
}
else{
window.alert("登录成功"+data.userName)
console.log(data)
/* window.location.href = "success"*/
}
},
error:function (data){
window.alert("服务器连接失败"+data.userName)
console.log(data)
}
});
}