I have a jQuery quiz which works fine except for one small thing at the end. I want the app to go to the final page (ThankYouPage.html) and give some summary statistics. It goes to the page but it only shows the portion that says, "Thank you for taking this short quiz..." The summary stats do not appear. Can you tell me what is making this happen? My code is below. Thank you.
JS
function finalGrade() {
//pulls the current counter from local storage
var counter = localStorage.getItem('counter');
var myPercent = (counter / 3) * 100;
var myFinalPercent = myPercent.toFixed(2);
if (myPercent < 80) {
var failOrPass = "Failing";
var QuestionNumber = "Quiz on Croatia.";
var QuizDesc = "Quiz questions on the country of Croatia.";
var name = localStorage.getItem('name');
var email = localStorage.getItem('email');
QuizFailed(email, name, QuestionNumber, QuizDesc);
} else {
var failOrPass = "Passing";
//QuizPassed();
}
document.location.replace("ThankYouPage.html");
$('#summaryID').append("You scored " + counter + " out of a possible 3 for " + myFinalPercent + "%. This results in a " + failOrPass + " score.");
}
HTML5
<body>
<div class="container">
<h1>Thank you for taking this short quiz on the country of Croatia.</h1>
<p id="summaryID"></p>
</div>
<script src="js/init.js" type="text/javascript"></script>
<script src="js/xapiwrapper.min.js" type="text/javascript"></script>
</body>