1234567891011121314151617181920212223242526272829303132333435363738 |
- 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);
- });
|