Add: player list navigator

This commit is contained in:
2018-07-03 17:35:40 +09:00
parent e28bcf3437
commit cec8e18470
8 changed files with 122 additions and 122 deletions
+45 -3
View File
@@ -89,8 +89,6 @@ class PlayerList {
if(playerID === null || playerID === "")
return;
console.log(playerID);
let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/delete_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -126,7 +124,51 @@ class PlayerList {
loadPlayerListPage(1);
}
}
}
}
function loadPlayerListPage(pageNo) {
playerListPage = pageNo;
let pageIndex = pageNo - 1;
let startNo = pageIndex * 10;
let endNo = pageIndex * 10 + 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"]);
addPlayerList.updatePlayerList(replyJSON["PlayerList"]);
}
}
}