代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
span{
color: red;
}
</style>
</head>
<body>
<input type="text" name="" id="username" value="" />
<input type="password" name="" id="password" value="" />
<span id="spn">
</span>
<input type="button" name="" id="btn" value="登录" />
<ul class="list">
<!--<li>
<h2></h2>
<img src="" />
<p></p>
</li>-->
</ul>
<script src="cookie.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var btn = document.getElementById('btn');
var txt1 = document.getElementById('username');
var txt2 = document.getElementById('password');
var spn = document.getElementById('spn');
btn.onclick = function(){
setcookies('username',txt1.value,70);
setcookies('password',txt2.value,70);
var username = txt1.value;
var password = txt2.value;
var xkl1 = new XMLHttpRequest();
var url ='http://jx.xuzhixiang.top/ap/api/login.php?username=11&password=1212'
xkl1.open('get',url);
xkl1.send(null);
xkl1.onload = function(){
if(xkl1.status == 200){
console.log(xkl1.responseText);
var obj = JSON.parse(xkl1.responseText);
console.log(obj.msg);
spn.innerHTML = obj.msg;
if(spn.innerHTML == "登录成功")
{
location.href='details.html';
}else{
spn.style.display = 'inline-block';
spn.innerHTML = '请核对登录信息';
}
}
}
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。