<!DOCTYPE html>
<html>
<head>
<title>Ajax登录请求_get请求</title>
<meta charset=”utf-8″ />
<script type=”text/javascript”>
//定义ajax浏览器对象
var request;
function login(){
//补全ajax提交代码
request = new XMLHttpRequest();
request.onreadystatechange = function(){
if(request.readyState == 4 && request.status==200){
document.getElementById(“div1”).innerHTML= request.responseText;
}
};
var password = document.getElementById(“password”).value;
request.open(“get”,”res/htmlclassics/php/test_login.php?&password=”+password,false);
request.send(null);
}
</script>
</head>
<body>
<h2>用户登录</h2>
<br/><br/>
<b>用户名:XueSheng</b>
<br/><br/>
<b>密码:</b><input id=’password’ value=’987654′ disabled=”disabled”/>
<br/><br/>
<input type=”button” value=”登录” οnclick=”login()” />
<br/><br/>
<div id=”div1″ style=”color:red;font-weight:bold;font-size:20px;”></div>
</body>
</html>
原文地址:https://blog.csdn.net/Playful_Elbow/article/details/124359958
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_50905.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!