Change button after submit - jquery, django
<p>i have an ajax "follow" button. It works fine and after submit the button's attribute <code>disabled</code> becomes <code>"disabled"</code>. But i want to change "follow" button to "unfollow" button after submit just like in Twitter. How to do this? I Tried this to change button's attribute "form" to submit another form:</p>

<pre><code>success:function(){
                $button.attr('form','unfollow');
</code></pre>

<p>but unfortunately it doesnt work.</p>

<p>template <strong>event.html:</strong></p>

<pre><code>   {% if user in event.users.all %}
            &lt;form id="unfollow"&gt;
            {% csrf_token %}
            &lt;input type="hidden" value="{{ event.id }}" name="remove"&gt;
            &lt;button type="submit" class="btn btn-warning btn-block"&gt;{% trans "Unfollow"%}&lt;/button&gt;
            &lt;/form&gt;
    {% else %}
            &lt;form id="follow"&gt;
            {% csrf_token %}
            &lt;input type="hidden" value="{{ event.id }}" name="add"&gt;
            &lt;button type="submit" class="btn btn-primary btn-block"&gt;{% trans "Follow"%}&lt;/button&gt;
            &lt;/form&gt;
    {% endif %}

    &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;

    $(document).on('submit','#unfollow', function(e){
        var $button = $(this).find('button');
        e.preventDefault();
        $.ajax({
            url:'/event/{{ event.id }}/',
            data: "remove={{ event.id }}",
            success:function(){
                $button.attr('disabled', 'disabled').text('{% trans "Unfollowed" %}');
            }
        })
    });

    $(document).on('submit','#follow', function(e){
        var $button = $(this).find('button');
        e.preventDefault();
        $.ajax({
            url:'/event/{{ event.id }}/',
            data: "add={{ event.id }}",
            success:function(){
                 $button.attr('disabled', 'disabled').text('{% trans "Followed" %}');
            }
        })
    });

&lt;/script&gt;
</code></pre>

<p><strong>views.py</strong></p>

<pre><code>user = request.user
if request.GET.get('add'):
    event.users.add(user)
    event.save()
if request.GET.get('remove'):
    event.users.remove(user)
    event.save()
</code></pre>