Quiz Quick Reference

Interactive quiz system with questions, answers, and photo support

Key Features Server-Side Usage: // Get the Quiz API var Quiz = js.getObject("/OpenForum/AddOn/Quiz","Quiz.sjs"); // Create quiz var quizData = { title: "My Quiz", questions: [ { question: "What is 2 2?", answers: ["3", "4", "5"], correct: 1, photo: "question1.jpg" } ] }; Quiz.saveQuiz("/MyPage", "quiz.json", quizData); // Load quiz var quiz = Quiz.loadQuiz("/MyPage", "quiz.json"); // Get quiz results var results = Quiz.getResults("quizId", "userId"); Client-Side Usage: // Load quiz JSON.get('/OpenForum/AddOn/Quiz/Load', null, 'pageName=/MyPage&fileName=quiz.json') .onSuccess(function(quiz) { console.log('Quiz loaded:', quiz); }).go(); // Submit quiz answers JSON.post('/OpenForum/AddOn/Quiz/Submit', null, 'quizId=quiz123&answers=' JSON.stringify(userAnswers)) .onSuccess(function(result) { console.log('Score:', result.score); }).go(); Quiz Data Format { "title": "Quiz Title", "timer": 300, "questions": [ { "question": "Question text?", "answers": ["Option 1", "Option 2", "Option 3"], "correct": 1, "photo": "photo.jpg", "explanation": "Why this answer is correct" } ] } Configuration