Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form>
- <input class='btn btn-primary ml-auto' onclick="next()" id="next_button" type="button" role='button' value='Next'>
- </form>
- count = '{{ question.id }}';
- function next() {
- count++;
- $.ajax({
- url: '{% url "next_question" %}',
- type: 'GET',
- dataType: 'json',
- data: {'question_id': count},
- success: function(data){
- document.getElementbyId('question').innerText = data.fields.question;
- console.log(count);
- }
- error: function(){
- $('#next_button').disabled = true;
- alert("Either that's the last question or an error occured!");
- }
- });
- };
- if(confirm('Are you ready to start the test?')){
- timer(10);
- } else{
- window.location = '{% url "Home" %}'
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement