how to pass multiple ajax calls in a single django view
<p>I have a form with multiple button which is mapped to a django view. Like:</p>

<pre><code>&lt;form name="demo-form" method="POST" action="{% url 'internalManifest' %}"&gt;
    &lt;button class="btn btn-success" name="start_manifest"&gt;Start Manifest&lt;/button&gt;
    &lt;button class="btn btn-success" name="close_manifest"&gt;Close Manifest&lt;/button&gt;
&lt;/form&gt;
</code></pre>

<p>The above two buttons call two different methods from models.py but i can do it from a single django view. Like:</p>

<p>Django view:</p>

<pre><code>if request.method == 'POST' and 'start_manifest' in request.POST:
    call_function1()
if request.method == 'POST' and 'close_manifest' in request.POST:
    call_function2()
</code></pre>

<p>My question is, how to send two different ajax request like this to same view function based on name of button?</p>

<p>Lets say I have 2 ajax request. Both calls different method from models.py. I want to send the ajax call based on button name. like:</p>

<pre><code>jQuery(document).ready(function($){
    $('[name="form_internal_manifest"]').on('submit', function(event){
        event.preventDefault();
        $.ajax({
            url : "/internalmanifest/",
            type : "POST",
            ...

jQuery(document).ready(function($){
    $('[name="form_internal_manifest"]').on('submit', function(event){
        event.preventDefault();
        $.ajax({
            url : "/internalmanifest/",
            type : "POST",
            ...
</code></pre>