Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 916633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:04:57+00:00 2026-05-15T18:04:57+00:00

I am using jQuizMe, the jQuery plugin for quizzes, and I want to get

  • 0

I am using jQuizMe, the jQuery plugin for quizzes, and I want to get the quiz questions out of a database. So I thought that I could use an ajax call to fetch the questions and process them to mimic a JSON-like array. I would then like to take that AJAX responseData and store it (as a JSON-like array) in a javascript variable.

Here is the code:

$(document).ready(function() {
    var quiz = new Array();
    $.get("/base/GameList/GetGameQuestions/StatesAndCapitalsGame.aspx", function(data)  {
        quiz = data;
    });

    var options = {
        intro: "Find out if you know which Capital is for which State.",
        allRandom: true,
        title: "State Capitals Quiz",
        fxType: 1
    };
    var lang = {
        praise: "Great job, right!"
    };

    $("#quizArea").jQuizMe(quiz, options, lang);

});

And the data that is coming back looks like this:

{
    multiList: [
        { ques: "What is the capital of Alabama?",
          ans: "Montgomery",
          ansSel: ["Hamptonville", "Ellenville", "Somerville"]
        },
        { ques: "What is the capital of New Jersey?",
          ans: "Trenton",
          ansSel: ["Hamptonville", "Ellenville", "Somerville"]
        }
    ]
};

I was thinking this probably would not work correctly because it is just assigning this response to the quiz variable as a string, but I was hoping you all could guide me in the right direction.

Thanks!

EDIT:
I solved this by using what Groo suggested (in a modified form). Thanks for all your suggestions everyone!

$(document).ready(function() {
function runQuiz(quiz) {
   var options = {
       quizType: "multiList",
       intro: "Find out if you know which Capital is for which State.",
       allRandom: true,
       title: "State Capitals Quiz",
       fxType: 1
   };
   var lang = {
       praise: "Great job, right!"
   };
    var stuff = new Array();
    stuff = eval('(' + quiz + ')');
   $("#quizArea").jQuizMe(stuff, options, lang);
}

    $.get("/base/GameList/GetGameQuestions/StatesAndCapitalsGame.aspx", function(data)  {
        runQuiz(data);
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:04:58+00:00Added an answer on May 15, 2026 at 6:04 pm

    You can add dataFilter and error handlers for a jQuery.ajax call, to check how your JSON data looks like when received:

    var runQuiz = function(quiz) {
       var options = {
           intro: "Find out if you know which Capital is for which State.",
           allRandom: true,
           title: "State Capitals Quiz",
           fxType: 1
       };
       var lang = {
           praise: "Great job, right!"
       };
    
       $("#quizArea").jQuizMe(quiz, options, lang);
    }
    
    $.ajax({
          type: "POST",
          url: "/base/GameList/GetGameQuestions/StatesAndCapitalsGame.aspx",
          data: { },
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          timeout: 15000,
          dataFilter: function(data, type) {
              // alert(data);
              return data;
          },
          error: function(xhr, textStatus, errorThrown) {
              // alert(textStatus + ' ' + errorThrown);
          },
          success: runQuiz
     });
    

    For debugging purposes, you can uncomment the handler for dataFilter event, to get the raw JSON string that your web service is returning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ThreadPoolRuntime, I could get a throughput attiribute that means The mean number of
Using jQuery, one can easily find out whether a particular element is visible using
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
Using Yii, I want to delete all the rows that are not from today.
Using jQuery the jquery plugin along with the easing plugin. I have a series
Using a populated Table Type as the source for a TSQL-Merge. I want to
Using the Redis info command, I am able to get all the stats of
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using the HTML5 File API I can get the Binary String representation of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.