12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- $(".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);
- });
- function findGetParameter(parameterName) {
- var result = null,
- tmp = [];
- location.search
- .substr(1)
- .split("&")
- .forEach(function (item) {
- tmp = item.split("=");
- if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
- });
- return result;
- }
- 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
- }
|