smart-green-house-server-an.../html/enroll.html

43 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form onsubmit="return login(this);">
<div class="row">
<input name="name" placeholder="请输入账号">
</div>
<div class="row">
<input name="password" type="password" placeholder="请输入密码">
</div>
<div class="row center">
<button>确认</button>
</div>
</div>
</form>
</body>
<script>
function login(form) {
let login_data = {
name: form.name.value.trim(),
password: form.password.value.trim()
};
fetch("../cgi-bin/sqlite_cgi_insert_base.cgi", {
method: "POST",
body: JSON.stringify(login_data),
headers: {
"Content-Type": "application/json;charset=utf-8"
}
})
open("./login.html", "_self");
// window.localStorage.setItem("login_user", JSON.stringify(data));
return false;
}
</script>
</html>