123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- const btnLoginPage = document.querySelector('.btn-login');
- const btnUserProfile = document.querySelector('.btn-userProfile');
- const btnLogout = document.querySelector('.btn-logout');
- function loginControl() {
- btnLoginPage.style.display = 'none';
- btnLogout.style.display = 'block';
- btnUserProfile.style.display = 'block';
- }
- loginControl();
- function renderXHR_data(jsonObj) {
- XHRstring = ''
- for (const [key, value] of Object.entries(jsonObj)) {
- console.log(value)
- if (typeof (value) == "object") {
- XHRstring += (key+'=['+value.join(',')+']&')
- }
- else {
- XHRstring += (key + '=' + value + '&')
- }
- }
- XHRstring = XHRstring.substring(0, XHRstring.length - 1);
- return XHRstring
- }
- $(".sender").click(function () {
- var pwd = $("#in_pwd").val();
- var code = $("#code").val();
-
- var url = "/reset_pwd";
- var xhr = new XMLHttpRequest();
- xhr.open("POST", url);
- xhr.setRequestHeader("accept", "application/json");
- xhr.setRequestHeader("Content-Type", "application/json");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- alert('重設成功')
- }};
- var data = `{"code":"`+ code+`","password":"`+pwd+`"}`
- xhr.send(data);
- });
|