moved info injection into new function

This commit is contained in:
Václav Šmejkal 2024-05-22 18:09:05 +02:00
parent 2e0fdb2b24
commit 66b2ffb37a
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -35,24 +35,7 @@
username = event.target.innerHTML;
$.ajax
({
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
success: async function(result)
{
let admin_select = await selection("admin", result.admin);
let sex_select = await selection("sex", result.sex);
let output =
`Uživatelské jméno: <input id="username" class="editable" type="text" value="${result.username}"><br>
Přezdívka: <input id="nickname" class="editable" type="text" value="${result.nickname}"><br>
Admin: ${admin_select}<br>
Pohlaví: ${sex_select}<br>
Bio: <input id="bio" class="editable" type="text" value="${result.bio}"><br>`;
$("#right_panel").html(output + right_panel_buffer);
}
});
inject_info("#right_panel", username);
});
function remove_user()
@ -101,4 +84,26 @@
})
});
}
function inject_info(id, username)
{
$.ajax
({
url: "./res/forum/api/user_info.php?username=" + username,
success: async function(result)
{
let admin_select = await selection("admin", result.admin);
let sex_select = await selection("sex", result.sex);
let output =
`Uživatelské jméno: <input id="username" class="editable" type="text" value="${result.username}"><br>
Přezdívka: <input id="nickname" class="editable" type="text" value="${result.nickname}"><br>
Admin: ${admin_select}<br>
Pohlaví: ${sex_select}<br>
Bio: <input id="bio" class="editable" type="text" value="${result.bio}"><br>`;
$(id).html(output + right_panel_buffer);
}
});
}
</script>