forked from BlueDriver/questionnaire_online
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.html
45 lines (45 loc) · 1.1 KB
/
ajax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Register,Login" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no"/>
<title>ajax text</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style>
input{
width: 50vw;
font-size: 20px;
}
#result{
background-color: #51a42e;
padding: 10px;
}
button{
font-size: 20px;
}
</style>
</head>
<body>
<h1>最好打开控制台测试</h1>
<div></div>
<h3 id="result"></h3>
<input id="input" value="http://localhost:8123/demo/test" placeholder="请求的URL"></input><br>
<button id="btn">获取数据</button>
</body>
<script type="text/javascript">
$("#btn").click(function(){
console.log("click")
$("#result").text("")
$.ajax({
url: $("#input").val(),
method: "get",
success: res=>{
console.log(res)
$("#result").text(res)
}
})
})
</script>
</html>