Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <form>
  2. <input class='btn btn-primary ml-auto' onclick="next()" id="next_button" type="button" role='button' value='Next'>
  3. </form>
  4.  
  5. count = '{{ question.id }}';
  6. function next() {
  7. count++;
  8. $.ajax({
  9. url: '{% url "next_question" %}',
  10. type: 'GET',
  11. dataType: 'json',
  12. data: {'question_id': count},
  13. success: function(data){
  14. document.getElementbyId('question').innerText = data.fields.question;
  15. console.log(count);
  16. }
  17. error: function(){
  18. $('#next_button').disabled = true;
  19. alert("Either that's the last question or an error occured!");
  20. }
  21. });
  22. };
  23. if(confirm('Are you ready to start the test?')){
  24. timer(10);
  25. } else{
  26. window.location = '{% url "Home" %}'
  27. };
  28. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement