moved update_user fn to forum script

This commit is contained in:
Václav Šmejkal 2024-05-22 18:40:36 +02:00
parent c96b0efceb
commit b302d50a4e
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
2 changed files with 21 additions and 16 deletions

View File

@ -4,7 +4,7 @@
</div>
<div id="right_panel">
<div id="buttons">
<button onclick="update_user()" class="btn">Uložit Změny</button>
<button onclick="update()" class="btn">Uložit Změny</button>
<button onclick="remove_user()" class="btn">Odstranit Uživatele</button>
</div>
</div>
@ -51,21 +51,8 @@
});
}
function update_user()
function update()
{
$.ajax
({
url: "./res/forum/api/update_user.php" +
"?old_username=" + username +
"&username=" + document.getElementById("username").value +
"&nickname=" + document.getElementById("nickname").value +
"&admin=" + document.getElementById("admin").value +
"&sex=" + document.getElementById("sex").value +
"&bio=" + document.getElementById("bio").value,
success: function(result)
{
show("admin");
}
});
update_user(username, document.getElementById("username").value, document.getElementById("nickname").value, document.getElementById("admin").value, document.getElementById("sex").value,document.getElementById("bio").value, "admin");
}
</script>

View File

@ -51,4 +51,22 @@ function inject_info(id, username, postfix)
$(id).html(output + postfix);
}
});
}
function update_user(old_username, username, nickname, admin, sex, bio, refresh)
{
$.ajax
({
url: "./res/forum/api/update_user.php" +
"?old_username=" + old_username +
"&username=" + username +
"&nickname=" + nickname +
"&admin=" + admin +
"&sex=" + sex +
"&bio=" + bio,
success: function(result)
{
show(refresh);
}
});
}