mirror of
https://github.com/FAUSheppy/oh-my-nemesis
synced 2025-12-06 06:51:35 +01:00
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
function saveToServer(){
|
|
var xhttp = new XMLHttpRequest();
|
|
|
|
champ = "Atrox"
|
|
position = "Top"
|
|
affinity = "5"
|
|
|
|
req = "/save?type=teamChampSelect" + "&champ=" + cahmp
|
|
+ "&position=" + position
|
|
+ "&affinity=" + affinity
|
|
xhttp.open("POST", req, true);
|
|
//xhttp.setRequestHeader('Content-Type', 'application/json');
|
|
xhttp.send(json)
|
|
}
|
|
|
|
|
|
function addChamp(selectorId, role){
|
|
champ = document.getElementById(selectorId).value
|
|
url = window.location.href + "?" + "role=" + role +
|
|
"&" + "champ=" + champ +
|
|
"&" + "action=" + "add"
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
credentials: 'same-origin',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
referrerPolicy: 'strict-origin'
|
|
}
|
|
).then(window.location.reload());
|
|
}
|
|
|
|
|
|
function removeChamp(champ, role){
|
|
url = window.location.href + "?" + "role=" + role +
|
|
"&" + "champ=" + champ +
|
|
"&" + "action=" + "remove"
|
|
fetch(url, {
|
|
method: 'POST',
|
|
mode: 'cors',
|
|
credentials: 'same-origin',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
referrerPolicy: 'strict-origin'
|
|
}
|
|
).then(window.location.reload());
|
|
} |