Build a foundation of knowledge.
Have some relaxation time.
Visit our social pages.
Venenatis nibh vel arcu dui et dictum tristique dis tortor eget quis nullam congue massa lorem ante dictum eu vel commodo quis nunc
Enter your 5-digit quiz code:
✅ Correct!
"; score++; // ✅ Remove from review if previously answered incorrectly savePromise = fetch('/wp-content/themes/astra/eezeelounge-functions/ezl-remove-review.php', { method: 'POST', body: new URLSearchParams({ student_id: student_id, question_id: question_id }) }) .then(res => res.text()) .then(text => { if (!text.toLowerCase().includes("success")) { console.error("Failed to remove from review:", text); } else { console.log("Removed from review:", text); } }) .catch(err => console.error("Error removing from review:", err)); } else { feedback.innerHTML = `❌ Wrong. The correct answer was ${correct.toUpperCase()}.
`; // ❌ Save wrong answer savePromise = fetch('/wp-content/themes/astra/eezeelounge-functions/ezl-save-review.php', { method: 'POST', body: new URLSearchParams({ student_id: student_id, quiz_id: quiz_id, question_id: question_id, selected_option: selected }) }) .then(res => res.text()) .then(text => { if (!text.toLowerCase().includes("success")) { console.error("Failed to save review:", text); } else { console.log("Saved review:", text); } }) .catch(err => console.error("Error saving review:", err)); } // Add Next button feedback.innerHTML += `Error saving score. Please try again later.
`; }); }Question: ${r.question}
Your Answer: ${r.selected_text}
Correct Answer: ${r.correct_text}
No incorrect questions found for this student.
"; } // --- Past Quiz Scores Section --- if (scores.length > 0) { html += `Attempt #${a.attempt_number} — Score: ${a.score}/${a.total}
`; }); html += "No past quiz scores found for this student.
"; } resultsDiv.innerHTML = html; // --- Retake Button Functionality (same as before) --- document.querySelectorAll(".retakeBtn").forEach(btn => { btn.addEventListener("click", function() { const quiz_id = this.dataset.quiz; const student_id = this.dataset.student; const codeDisplay = this.nextElementSibling; fetch("/wp-content/themes/astra/eezeelounge-functions/ezl-new-quiz-code.php", { method: "POST", body: new URLSearchParams({ quiz_id, student_id }) }) .then(res => res.text()) .then(text => { codeDisplay.innerHTML = ` Quiz Code: ${text}`; }) .catch(err => { codeDisplay.innerHTML = "Error generating code"; console.error(err); }); }); }); }) .catch(err => { resultsDiv.innerHTML = "Error retrieving review data.
"; console.error(err); }); });