Hi, I am beginner to JQuery. I am preparing a test engine.. I want to display question with duration say 30 secs. each question have to displayed 30 secs after that next question should be displayed this should be repeated till the last question. Can we do this with Ajax? waiting for ur reply... any ideas or suggestions
A:
Yes, this can be done with Ajax:
- Fetch a question using an AJAX call like .load() AJAX queries with jQuery. Or you can load all questions in advance and just show the contents using the timer.
- Start a timer or use setTimeout("insert javascript here", timeout_in_milliseconds). Using search will provide you several jQuery timer plug-ins
- Repeat
- When all questions have been shown, exit.
Notice that you might want to store the value from setTimeout calls to a variable, if you want to cancel the timed event. For example, if you want a next question to be loaded right after the question is answered and you don't want the new question be replace by a rogue timed event.
Aleksi
2010-03-01 10:52:31