Add: registered_player_list_page
This commit is contained in:
@@ -70,6 +70,108 @@
|
||||
|
||||
<script>
|
||||
|
||||
let maestroID = -1;
|
||||
|
||||
$(document).ready(function() {
|
||||
maestroID = sessionStorage.getItem("maestroID");
|
||||
console.log("maestroID : " + maestroID);
|
||||
|
||||
loadPlayerList();
|
||||
});
|
||||
|
||||
function loadPlayerList() {
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/user/registered_player_count.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send("maestro_id=" + maestroID);
|
||||
xhr.onload = function() {
|
||||
if(xhr.readyState === 4 && xhr.status === 200) {
|
||||
// console.log(xhr.responseText);
|
||||
// console.log(xhr.responseText.length);
|
||||
if(xhr.responseText.length === 0 || xhr.responseText === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
|
||||
if(replyJSON === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
let playerCount = replyJSON["Count"];
|
||||
console.log("registered player count : " + playerCount);
|
||||
loadPlayerListPage(playerCount, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadPlayerListPage(playerCount, pageNo) {
|
||||
let startNo = 0;
|
||||
let endNo = 9;
|
||||
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/user/registered_player_list_page.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo);
|
||||
xhr.onload = function() {
|
||||
if(xhr.readyState === 4 && xhr.status === 200) {
|
||||
// console.log(xhr.responseText);
|
||||
// console.log(xhr.responseText.length);
|
||||
if(xhr.responseText.length === 0 || xhr.responseText === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
|
||||
if(replyJSON === null) {
|
||||
console.log("no data from server");
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["ERROR"] !== undefined || replyJSON["RESULT"] === undefined) {
|
||||
console.log(replyJSON["ERROR"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(replyJSON["RESULT"] === "fail") {
|
||||
console.log(replyJSON["RESULT"]);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(replyJSON["PlayerList"]);
|
||||
updatePlayerListPage(replyJSON["PlayerList"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updatePlayerListPage(playerList) {
|
||||
for(let i = 0; i < playerList.length; i++) {
|
||||
$("#registered_player_list").append(
|
||||
"<li>"
|
||||
+ "<input type='text' value='" + playerList[i]["Name"] + "' class='registered_player_list_name'>"
|
||||
+ "<input type='text' value='" + playerList[i]["EnterCode"] + "' class='registered_player_list_entercode'>"
|
||||
+ "<input type='button' value='수정'>"
|
||||
+ "</li>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function tabClicked(tabNo) {
|
||||
for(let i = 0; i < 4; i++) {
|
||||
$("#page-tabs li").filter(":eq(" + i + ")").removeClass("activated");
|
||||
|
||||
Reference in New Issue
Block a user