reset_pwd.js 864 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. function renderXHR_data(jsonObj) {
  2. XHRstring = ''
  3. for (const [key, value] of Object.entries(jsonObj)) {
  4. console.log(value)
  5. if (typeof (value) == "object") {
  6. XHRstring += (key+'=['+value.join(',')+']&')
  7. }
  8. else {
  9. XHRstring += (key + '=' + value + '&')
  10. }
  11. }
  12. XHRstring = XHRstring.substring(0, XHRstring.length - 1);
  13. return XHRstring
  14. }
  15. $(".sender").click(function () {
  16. var pwd = $("#in_pwd").val();
  17. var code = $("#code").val();
  18. var url = "/reset_pwd";
  19. var xhr = new XMLHttpRequest();
  20. xhr.open("POST", url);
  21. xhr.setRequestHeader("accept", "application/json");
  22. xhr.setRequestHeader("Content-Type", "application/json");
  23. xhr.onreadystatechange = function () {
  24. if (xhr.readyState === 4) {
  25. alert('重設成功')
  26. }};
  27. var data = `{"code":"`+ code+`","password":"`+pwd+`"}`
  28. xhr.send(data);
  29. });