document.onreadystatechange = function () {
if (document.readyState == "complete") {
document.body.style.display = "block";
} else {
document.body.style.display = "none";
};
};
function submit(){
var formData = new FormData(document.forms.namedItem("login_form"));
var obj = {
account:formData.get("account"),
keywords:formData.get("keywords")
}
var xhr = new XMLHttpRequest();
xhr.open("post","http://192.168.88.34/login");
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.send(JSON.stringify(obj));
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 ){
if(xhr.status == 200){
console.log('200'+xhr.responseText);
document.getElementById("normal").style.display="none"
document.getElementById("success").style.display="block"
}else{
console.log(xhr.responseText);
document.getElementById("normal").style.display="none"
document.getElementById("error").style.display="block"
document.getElementById("errortext").innerText="网络连接失败!失败的原因:"+xhr.responseText+"请钉钉联系安全部"
}
}
};
}