# Call a view from an AJAX script

**URL:** <https://forum.djangoproject.com/t/call-a-view-from-an-ajax-script/18046>\
**Category:** Forms & APIs\
**Created:** [January 7, 2023, 1:51am UTC](https://forum.djangoproject.com/t/call-a-view-from-an-ajax-script/18046 "2023-01-07T01:51:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stfarm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/stfarm/32/11632_2.png) [@stfarm](https://forum.djangoproject.com/u/stfarm)\
**Post date:** [January 7, 2023, 1:51am UTC](https://forum.djangoproject.com/t/call-a-view-from-an-ajax-script/18046/1 "2023-01-07T01:51:30Z")

</div>

I have a template that shows a question and multiple choice answers.  
I have pagination on the template and show one question at a time.  
How can I call a view that will save the users answers each time the next button is clicked. I can’t submit the form because that will end the quiz and calculate the score.  
I have not been able to get this working, does anyone have a solution?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 7, 2023, 1:55am UTC](https://forum.djangoproject.com/t/call-a-view-from-an-ajax-script/18046/2 "2023-01-07T01:55:26Z")

</div>

Break it down such that each page is a separate form - each form submission then is the submission of a single form.

If you’re looking for a package to help facilitate this, see [Form wizard — django-formtools 2.4.post2 documentation](https://django-formtools.readthedocs.io/en/latest/wizard.html). (It’s a package we use and rely upon.)

---

<div class="post-metadata">

**Author:** ![stfarm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/stfarm/32/11632_2.png) [@stfarm](https://forum.djangoproject.com/u/stfarm)\
**Post date:** [January 7, 2023, 2:01am UTC](https://forum.djangoproject.com/t/call-a-view-from-an-ajax-script/18046/3 "2023-01-07T02:01:35Z")

</div>

Interesting, never thought of that. How would I create new forms dynamically then? Maybe I am overthinking that. Thank you for the quick reply, I will check out the link.
