dtj4307 2013-02-26 06:00
浏览 8
已采纳

单击下一页后如何继续进行考试计时器[关闭]

I am making an online exam but the timer part has a problem. Every time a user click on the next button to get a new page, the timer restarts. Here is my code. I am using laravel

http://paste.laravel.com/iOo

I also want to add the option of saving and exiting if one cannot complete the exam. Any help will be greatly appreciated.

  • 写回答

2条回答 默认 最新

  • douyanyan1123 2013-02-26 09:17
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀