Hi, My multiple choice code works fine, except it executes the new/next question too fast. I tried to set a delay so there is at least 2 seconds until the next question is loaded, but setTimeout(function(){return_next_question;}, 2000); doesn't seem to wait until it calls the value of return_next_question.
What's going on?
Thanks.
Code:var return_next_question = $("#ajaxArea").load("ajax-part.php"); function next_question() { // Sets value for return_next_question while user is reading current one return_next_question = $("#ajaxArea").load("ajax-part.php"); } function checkAnswer(id, value) { var button_id = document.getElementById(id); if (value == 0) { ...Some stuff happens setTimeout(function(){return_next_question;}, 2000); } else { // value == 1 and answer is correct ...Some stuff happens setTimeout(function(){return_next_question;}, 2000); } // Prepare the next_question() while user is reading current one next_question(); }


Reply With Quote
Bookmarks