Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. function checkNickname() {
  2. let nickname = document.getElementById("nickname").value;
  3. let resp;
  4. fetch("http://edi.iem.pw.edu.pl/chaberb/register/check/" + nickname, {
  5. mode: "no-cors",
  6. headers: {
  7. "Content-Type": "application/json"
  8. },
  9. })
  10. .then(function (response) {
  11. resp = response
  12. })
  13. .catch(function (response) {
  14. console.log(response)
  15. });
  16.  
  17. if ( resp ) {
  18. document.getElementById("nicknameCheckResponse").innerHTML = "Nickname too awesome and is already taken"
  19. }
  20. }
  21.  
  22. function sendForm() {
  23. fetch('http://edi.iem.pw.edu.pl/chaberb/register/user/', {
  24. method: 'POST',
  25. body: document.getElementById("form")
  26. }).then(function (response) {
  27. console.log(response)
  28. })
  29. .catch(function (response) {
  30. console.log(response)
  31. })
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement