mirror of
https://gitee.com/many2many/java-web.git
synced 2025-01-11 22:50:54 +08:00
52 lines
2.0 KiB
HTML
52 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Fetch API Example</title>
|
|
<!-- 引入 Bootstrap -->
|
|
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
|
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
|
|
|
<!-- 引入自定义 JavaScript 文件 -->
|
|
<script src="app.js" defer></script>
|
|
</head>
|
|
<body>
|
|
<div class="container mt-5">
|
|
<h1 class="mb-4">Fetch API Practice</h1>
|
|
|
|
<!-- GET 请求按钮 -->
|
|
<button id="getButton" class="btn btn-primary mb-3">GET Request</button>
|
|
<!-- 显示 GET 请求结果的区域 -->
|
|
<div id="getResults" class="card">
|
|
<div class="card-body">
|
|
<p class="card-text">Click the button to make a GET request and see the results here.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- POST 请求表单 -->
|
|
<form id="postForm" class="mt-5">
|
|
<h2>POST Request Form</h2>
|
|
<div class="mb-3">
|
|
<label for="title" class="form-label">Title</label>
|
|
<input type="text" class="form-control" id="title" placeholder="Enter Title">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="body" class="form-label">Body</label>
|
|
<textarea class="form-control" id="body" rows="3" placeholder="Enter Body"></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="userId" class="form-label">User ID</label>
|
|
<input type="text" class="form-control" id="userId" placeholder="Enter User ID">
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Send POST Request</button>
|
|
</form>
|
|
<!-- 显示 POST 请求结果的区域 -->
|
|
<div id="postResults" class="card mt-3">
|
|
<div class="card-body">
|
|
<p class="card-text">Submit the form to make a POST request and see the results here.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |