added remove_user btn function

This commit is contained in:
Václav Šmejkal 2024-05-21 17:49:26 +02:00
parent eb7c925857
commit 709a2ccc78
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -3,11 +3,12 @@
Zde budou uživatelé. Zde budou uživatelé.
</div> </div>
<div id="right_panel"> <div id="right_panel">
<button id="remove_btn">Odstranit Uživatele</button> <button onclick="remove_user()" id="remove_btn">Odstranit Uživatele</button>
</div> </div>
</div> </div>
<script> <script>
let right_panel_buffer = null; var right_panel_buffer = null;
var username = null;
$(document).ready(function() $(document).ready(function()
{ {
@ -28,6 +29,8 @@
$("#remove_btn").show(); $("#remove_btn").show();
if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML; if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML;
username = event.target.innerHTML;
$.ajax $.ajax
({ ({
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML, url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
@ -37,4 +40,17 @@
} }
}); });
}); });
function remove_user()
{
$.ajax
({
url: "./res/forum/api/remove_user.php?username=" + username,
success: function(result)
{
//location.reload();
show("admin");
}
});
}
</script> </script>