You may want to try this way:
- When test starts, create an session variable for the current test for holding questions, for example, 'testQuestions'
- Create a function that will send json output containing a single question from 'testQuestions' array. So whenever you query that url with proper index, you get that question. you can also add additional information, such as nextQuestionIndex, prevQuestionIndex, etc., when sending that question. They will help you to crate Next and Previous buttons on frontend.
- Then on front-end, you can create multiple sections (or divs with IDs), one for displaying timer, one for displaying question.
- Then write function in JavaScript for click events on next and previous button. You can send ajax request and get json response containing next question. You can modify the content of current question to display next or previous question.
You can improve upon this strategy and submit the questions form when Next or Previous button is clicked. This way, you will be updating answer for a question and receiving next/previous question in the single call. Because you will be using ajax request, you can avoid page refresh.