I have implemented an online quiz using jQuery. I have this specific requirement I want to implement at the end of the quiz.
if (number_of_answered_questions == total_questions) {
save the score to the database;
redirect to redirect_url;
}
This redirect_url
depends on the score. (for ex: if the score < 10
, redirect to page1.html and if 10 < score < 15
, redirect to page2.html)
I tried using jQuery.post
, but I'm not sure how to implement both in the same 'post'.
How can I implement these two tasks in jQuery?
I can't write the logic to "save to database" in the redirect pages because they keep changing. (I mean admin can change the redirect pages).