diff --git a/ajax.php b/ajax.php index cbfe42b..7dfcb34 100644 --- a/ajax.php +++ b/ajax.php @@ -12,7 +12,7 @@ $questID_arr = Question::getList( $quiz->getID() ); $index_int = array_search( $quest->getID(), $questID_arr ); $index_int++; -$nextQuest = new Question( $index_int ); +$nextQuest = new Question( $questID_arr[ $index_int ] ); $ans_arr = $nextQuest->getAnswers(); $data_arr = array( diff --git a/quiz.js b/quiz.js index 719433c..5cac0df 100644 --- a/quiz.js +++ b/quiz.js @@ -16,7 +16,22 @@ $( document ).ready( function() { quest : id.quest[ questNum - 1], ans : ans, } ).done( function( data ){ - console.log( data ); + questNum++; + $( "#question-text" ).text( data.text ); + $( "#answers" ).empty(); + + $.each( data.ans, function( index, value ){ + $( "#answers" ).append( '\ +