Add: player list manager

This commit is contained in:
2018-07-04 08:48:36 +09:00
parent 8db6dd19ad
commit 8d9e48af39
8 changed files with 435 additions and 130 deletions
+55 -2
View File
@@ -1,8 +1,61 @@
<script type="text/javascript">
$(document).ready(function() {
searchPlayerList = new PlayerList($("#search_player_list"));
searchPlayerListNavigator = new PlayerListNavigator($("#search_player_list_navigator > #page_no_area"));
searchPlayerListManager = new PlayerListManager(
$("#search_player_list"),
$("#search_player_list_navigator > #page_no_area")
);
// searchPlayerList = new PlayerList($("#search_player_list"));
// searchPlayerListNavigator = new PlayerListNavigator($("#search_player_list_navigator > #page_no_area"));
searchPlayerListManager.updateSearchPlayerListPage(1);
});
function searchPlayer() {
// let maestroID = sessionStorage.getItem("maestroID");
let playerName = $("#search_name").val();
if(playerName.length === 0) {
$("#add_player_notice").val("학생 이름을 입력하세요.");
$("#add_player_name").focus();
}
let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/search_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName);
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;
}
loadPlayerListPage(1);
}
}
}
</script>