Forum Moderators: open

Message Too Old, No Replies

Javascript-coded quizzes

Can I grab the user's scores and save them?

         

ChanandlerBong

2:18 pm on Sep 19, 2018 (gmt 0)

10+ Year Member Top Contributors Of The Month



This is a project I will get a freelancer to do, but I had a basic feasibility question first.

I have an education site with many javascript-coded quizzes: multiple-choice, gap fill, that type of thing. Each quiz is a form which is submitted, the score worked out and document.write is used to create an answers & scores pop-up. All well and good and it's been working like this since 2004.

I would like to turn the site into a more complex membership site where users can see stats, charts, etc based on all the quizzes they've done in the past. My question is - would this be possible with the current javascript-driven setup or would I need to alter the technology?

NickMNS

2:28 pm on Sep 19, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Oh the irony!

First, to accurately answer the question one would need to know what the current technology is. Essentially you need a DB to save the user accounts and each user's results as well as the aggregate of all results. Then you need to query the data to calculate and display the metrics. This is do-able with js-driven. But the devil is in the details without details essentially anything is possible.

Leosghost

5:20 pm on Sep 19, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just a thought..you will need to think about GDPR if doing what you suggest..whichever "tech" you use..

ChanandlerBong

7:06 pm on Sep 19, 2018 (gmt 0)

10+ Year Member Top Contributors Of The Month



this is almost exactly the JS technology I'm using. I have no connection to this site, it's not even in my language, but you can see how answers are passed and the pop-up that appears at the end on pressing Submit.

[sauce.pntic.mec.es ]

As JS is front-end, will I have difficulty grabbing these results and then saving them into a DB? Would I have to re-code the quizzes into something more back-end friendly?

NickMNS

7:55 pm on Sep 19, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There basically is no technology in the page you linked to. The page is static and the answers are hard-coded into the page. All the script does is take the user's submitted value and compares it to the hard-coded one and returns true or false.

If this is what you have, then you have none of the building blocks set for what you would like to do. This isn't necessarily a bad thing, it will allow you to start from scratch and select the technologies that are best suited for your needs.

As JS is front-end, will I have difficulty grabbing these results and then saving them into a DB?

I would use JS specifically. The Single Page App pattern is ideal for what you describe. The user loads a shell page, then questions, answers and all interactions with the back-end are handled with XHR Requests (AJAX). But this is nothing like what you have presently.