I am creating a Django web application which features a voting system similar to what is on this website. 

Currently, when you click on an upvote or downvote arrow, I use jQuery to handle the change in color and the change in the vote score (number of votes). I basically take the vote score that was originally pulled from the database and add or minus one accordingly, and show this number. I am not updating the score from the database, so that the vote seems consistent to the user (in case other people cast votes while the user is on the site). 

I am having trouble with the ajax part. Basically, when the user votes, I still want to send the upvote or downvote submission to the server and update the database, but not have the page refresh. When I don't add "return false" to the end of the ajax call, my database gets updated, but my page refreshes. However, when I add "return false" to the end of the ajax call, my page doesn't refresh, but the database also doesn't get updated. 

Here is my form:

```
<form method="post" class="voting-button" action="/sentence/vote/{{sentence.id}}/">
                    {% csrf_token %}
                    <input type="submit" class="upvote_on" name="upvote" value="" />
                    <p class="vote-score">{{sentence.total_votes}}</p>
                    <input type="submit" class="downvote_off" name="downvote" value="" />
                </form>

```

It is a form with two submit buttons: one for upvote and one for downvote. 

Here is the javascript for when you click on the upvote button:

```
<script type="text/javascript">         
    //script to control arrows and the number of votes shown
        $("[name='upvote']").click(function(){
            if ( $(this).attr("class") == "upvote_off" ) {
                $(this).attr("class", "upvote_on");

                //If upvote is off and downvote is off
                if ( $(this).siblings("[name='downvote']").attr("class") == "downvote_off"){
                    var score = $(this).siblings(".vote-score").text();
                    scoreInt = parseInt(score)
                    scoreInt += 1;
                    $(this).siblings(".vote-score").text(scoreInt);
                } else { //if upvote is off and downvote is on
                    var score = $(this).siblings(".vote-score").text();
                    scoreInt = parseInt(score)
                    scoreInt += 2;
                    $(this).siblings(".vote-score").text(scoreInt);
                }

                $(this).siblings("[name='downvote']").attr("class", "downvote_off");

            } else {
                $(this).attr("class", "upvote_off");       

                $(this).siblings("[name='downvote']").attr("class", "downvote_off");

                var score = $(this).siblings(".vote-score").text();
                scoreInt = parseInt(score)
                scoreInt -= 1;
                $(this).siblings(".vote-score").text(scoreInt);
            }

            $.post(

            '/sentence/vote/{{sentence.id}}/',
            {
            name: "upvote",
            },

            function(response){
                $("#divText").text("hello world!");
            }
            )

        })

```

Basically, the gist of it is that the upvote button can have one of two classes: "uvpote\_off" or "upvote\_on", depending on whether the user upvoted or not. The if else statements are just to make change these states are changed correctly. 

Here is my django view function, which the form sends to: 

```
def vote(request, sentence_id):
p = get_object_or_404(Sentence, pk=sentence_id)

if 'upvote' in request.POST:
    try:
        v = Vote.objects.filter(voter = request.user).get(sentence=p)
        if v.score == 0:
            v.score = 1
        elif v.score == 1:
            v.score = 0
        else: #for case where v.score = -1
            v.score = 1 
        v.save()
    except Vote.DoesNotExist:
        v = Vote( voter =request.user, sentence=p, score=1)
        v.save()

elif 'downvote' in request.POST:
    try:
        v = Vote.objects.filter(voter = request.user).get(sentence=p)
        if v.score == 0:
            v.score = -1
        elif v.score == -1:
            v.score = 0
        else: #for case where v.score = 1
            v.score = -1
        v.save()
    except Vote.DoesNotExist:
        v = Vote( voter = request.user, sentence=p, score=1)
        v.save()

return HttpResponseRedirect(reverse('sentence.views.show_sentence_order', args=(p.sentence_order,)))

```

What exactly is the problem is here? I've been struggling with this for the last few hours and looked at a bunch of tutorials, but can't figure out what I'm doing wrong.

Thank you in advance for your help.