<body>
<h1>登录</h1>
<input type="text" placeholder="请输入用户名" id="uname">
<br><br>
<input type="text" placeholder="请输入密码"
id="upwd">
<br><br>
<button onclick="login()">点击登录</button>
<script>
function login(){
var u_uname=uname.value;
var u_upwd=upwd.value;
var xhr=new XMLHttpRequest();
xhr.onreadystatechange=function(){
if(xhr.readyState==4&&xhr.status==200){
var result=xhr.responseText;
alert(result);
};
};
xhr.open("post","http://127.0.0.1:8080/pro/login",true);
var formdata="uname="+u_uname+"&upwd="+u_upwd;
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.send(formdata);
};
</script>