Padel-Tournaments-System/frontend/logowanie/app.js
Arek f7cd8783be feat: adding api
adding api connection to registration and tournament making
2022-06-01 22:23:12 +02:00

18 lines
744 B
JavaScript

document.getElementById("loginsubmit").addEventListener("click", function () {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
alert("logged in");
console.log("dziala");
} else if (this.readyState == 4) {
alert("something not work :( " + this.status);
console.log("nie dziala");
}
}
xhttp.open("POST", "https://dragonmaster.pl/inz/user/login");
xhttp.send('{"username":"' + document.getElementById("loginusername").value + '","password":"' + document.getElementById("loginpassword").value + '"}');
});
function submit() {
("form").submit(function () { return false; })
}