| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- function rankingClick() {
- $("#minigame-ranking-data-box").removeClass("hide");
- $("#minigame-rule-data-box").addClass("hide");
- }
- function ruleClick() {
- $("#minigame-rule-data-box").removeClass("hide");
- $("#minigame-ranking-data-box").addClass("hide");
- }
- function redirectToRank() {
- $.ajax({
- url: '/MiniGame/GetWinner',
- type: 'GET',
- success: function (result) {
- $('#ranking_data').html(result); // Sửa từ .ranking_data thành #ranking_data
- $("#minigame-rule-data-box").addClass("hide");
- $("#minigame-ranking-data-box").removeClass("hide");
- },
- error: function () {
- $('#ranking_data').html('<p>Error loading ranking.</p>'); // Sửa từ .ranking_data thành #ranking_data
- }
- });
- }
- function loadPlay() {
- console.log("loadPlay");
- $.ajax({
- url: '/MiniGame/PlayQuestion',
- type: 'POST',
- success: function (result) {
- console.log(result);
- $('#open_play').html(result);
- },
- error: function () {
- console.log("error");
- $('#open_play').html('<p>Error loading Play.</p>');
- }
- });
- }
- //let selectedAnswer = null;
- //let answerList = [];
- //let currentQuestionIndex = 0;
- //let selectedAnswer = null;
- //let answerList = []; // Danh sách lưu các đáp án đã chọn
- //function updateQuestion() {
- // // Cập nhật nội dung câu hỏi và các đáp án trên giao diện
- // const newQuestion = @Html.Raw(JsonConvert.SerializeObject(Model.questions))[questionIndex - 1];
- // document.querySelector('.question-container').setAttribute('data-question-id', newQuestion.id);
- // document.querySelector('.text-c-2').innerText = newQuestion.content;
- // // Cập nhật các đáp án
- // const buttons = document.querySelectorAll('.answer-box button');
- // buttons.forEach((btn, index) => {
- // btn.innerText = newQuestion[`answer${index + 1}`];
- // btn.onclick = () => selectAnswer(btn, newQuestion[`answer${index + 1}`]);
- // });
- //}
- //function sendAnswersToServer() {
- // const data = {
- // serviceId: "3",
- // LESSON_ID: "-1",
- // ANSWER_LIST: answerList
- // };
- // $.ajax({
- // url: '/MiniGame/ConfirmPlayQuestion',
- // type: 'POST',
- // contentType: 'application/json',
- // data: JSON.stringify(data),
- // success: function (result) {
- // console.log(result);
- // $('#open_play').html(result);
- // },
- // error: function () {
- // console.log("error");
- // $('#open_play').html('<p>Error loading Play.</p>');
- // }
- // });
- //}
|