Search update
This commit is contained in:
@@ -12,8 +12,28 @@ const nomatch = document.getElementById("nomatch");
|
||||
|
||||
updateTableVisibility();
|
||||
|
||||
if (searchForm)searchForm.onsubmit = async e => {
|
||||
document.querySelectorAll("input[type='checkbox']").forEach(checkbox => {
|
||||
checkbox.addEventListener("change", e => {
|
||||
e.preventDefault();
|
||||
updateSearch();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("input[type='text']").forEach(checkbox => {
|
||||
checkbox.addEventListener("change", e => {
|
||||
e.preventDefault();
|
||||
updateSearch();
|
||||
});
|
||||
});
|
||||
|
||||
if (searchForm)searchForm.onsubmit = e => {
|
||||
e.preventDefault();
|
||||
updateSearch();
|
||||
};
|
||||
|
||||
updateSearch();
|
||||
|
||||
async function updateSearch () {
|
||||
if (!verifyLogin()) return;
|
||||
|
||||
const formData = new FormData(searchForm);
|
||||
@@ -25,7 +45,7 @@ if (searchForm)searchForm.onsubmit = async e => {
|
||||
}
|
||||
|
||||
let resultObject = await postData("/getPlayers", {
|
||||
player: document.getElementById("query").value,
|
||||
player: document.getElementById("query").value || "%",
|
||||
positions: positions
|
||||
}, token);
|
||||
|
||||
@@ -53,7 +73,6 @@ if (searchForm)searchForm.onsubmit = async e => {
|
||||
tableBody.innerHTML = "";
|
||||
resultObject.matches.forEach(player => {
|
||||
const row = document.createElement("tr");
|
||||
console.log(player);
|
||||
|
||||
//for (attribute in player) {
|
||||
// row.innerHTML += `<td>${player}</td>l`;
|
||||
|
||||
Reference in New Issue
Block a user