<title>BW Manager</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
var titleId = "my title id";
var developerSecretKey = "my secret key";
var apiEndpoint = "https://my title id.playfabapi.com/";
function connectToPlayFab()
{
$.ajax
({
type: "POST",
url: apiEndpoint,
headers:
{
"X-SecretKey": developerSecretKey.toUpperCase()
},
success: function ()
{
console.log("Đã kết nối tới PlayFab");
// Gọi hàm truy xuất tất cả người dùng
getAllUsers();
},
error: function ()
{
console.log("Lỗi khi kết nối tới PlayFab");
}
});
}
function getAllUsers()
{
$.ajax
({
type: "POST",
url: apiEndpoint + "Admin/GetAllUsers",
headers:
{
"X-SecretKey": developerSecretKey.toUpperCase()
},
success: function (data)
{
console.log("Dữ liệu người dùng: ", data);
// Hiển thị danh sách người dùng lên trang web
var userList = $("#user-list");
for (var i = 0; i < data.data.Users.length; i++)
{
userList.append("<li>" + data.data.Users[i].Username + "</li>");
}
},
error: function ()
{
console.log("Lỗi khi truy xuất người dùng");
}
});
}
$(document).ready(function ()
{
connectToPlayFab();
});
</script>
<h1>Truy xuất dữ liệu</h1>
<ul id="user-list"></ul>
I have no experience with web writing, I only have experience writing game code so maybe this web code is faulty somewhere. please help me fix it