Files
oh-my-nemesis/static/team_champselect.js
Yannik Schmidt 90ccfcdf51 Initial (reset)
2021-07-30 00:42:41 +02:00

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());
}