From 8fb2a55b8cf9d59cd4f956398dab075b7c5f665d Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 24 Jul 2022 20:31:50 +0800 Subject: [PATCH] test api --- js/function.js | 21 +++++++++++++++++++++ testtttttt.html | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 testtttttt.html diff --git a/js/function.js b/js/function.js index 50515b7..cb09912 100644 --- a/js/function.js +++ b/js/function.js @@ -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) { diff --git a/testtttttt.html b/testtttttt.html new file mode 100644 index 0000000..0563d2f --- /dev/null +++ b/testtttttt.html @@ -0,0 +1,20 @@ + + + + + + + sv7dgas78iref + + + + + + + + \ No newline at end of file