This commit is contained in:
2022-07-24 20:31:50 +08:00
parent 0d76fe02e8
commit 8fb2a55b8c
2 changed files with 41 additions and 0 deletions
+21
View File
@@ -46,7 +46,28 @@ function Get_Html(url)
}
function Post_Html(url,send)
{
var request = new XMLHttpRequest();
request.open("post", url,false);
httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");//设置请求头 注:post方式必须设置请求头(在建立连接后设置请求头)
//httpRequest.send('name=teswe&ee=ef');//发送请求 将情头体写在send中
request.send(send);
if(request.status==200)
{
var html=request.response;
//Printf("status code:200\n"+html);
return html;
}else
{
Printf("Error Can't open the page! Status code: "+request.status);
return "";
}
}
//获取json
function Get_Json(url)
{
+20
View File
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sv7dgas78iref</title>
<script src="js/function.js"></script>
</head>
<body>
</body>
</html>
<script>
Printf("login test");
var rt=Get_Html("http://127.0.0.1:5500/");
Printf(rt);
</script>