invite_register.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. $(".sender").click(function () {
  2. var pwd = $("#in_pwd").val();
  3. var code = $("#code").val();
  4. var url = "/reset_pwd";
  5. var xhr = new XMLHttpRequest();
  6. xhr.open("POST", url);
  7. xhr.setRequestHeader("accept", "application/json");
  8. xhr.setRequestHeader("Content-Type", "application/json");
  9. xhr.onreadystatechange = function () {
  10. if (xhr.readyState === 4) {
  11. alert('重設成功')
  12. }};
  13. var data = `{"code":"`+ code+`","password":"`+pwd+`"}`
  14. xhr.send(data);
  15. });
  16. function findGetParameter(parameterName) {
  17. var result = null,
  18. tmp = [];
  19. location.search
  20. .substr(1)
  21. .split("&")
  22. .forEach(function (item) {
  23. tmp = item.split("=");
  24. if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
  25. });
  26. return result;
  27. }
  28. function renderXHR_data(jsonObj) {
  29. XHRstring = ''
  30. for (const [key, value] of Object.entries(jsonObj)) {
  31. console.log(value)
  32. if (typeof (value) == "object") {
  33. XHRstring += (key+'=['+value.join(',')+']&')
  34. }
  35. else {
  36. XHRstring += (key + '=' + value + '&')
  37. }
  38. }
  39. XHRstring = XHRstring.substring(0, XHRstring.length - 1);
  40. return XHRstring
  41. }