I trying to replace button class with ajax, what i do wrong?

my button:

```
<input type="button" class="btn btn-default btn-sm addLike" name="{{ answer.pk }}" value="Like" ></input>

```

my js:

```
$('.addLike').click(function(){

    $.ajax({
        type: "POST",
        url: "{% url 'add_like' %}",
        data: {'answer_pk': $(this).attr('name'), 
                'csrfmiddlewaretoken': '{{ csrf_token }}'},
        dataType: 'json',
        success: function(response){
            alert(response.message);
            if ( $(this).hasClass('btn-default')) {
                $(this).removeClass('btn-default').addClass('btn-success');
            }
            else if ($(this).hasClass('btn-success')) {
                $(this).removeClass('btn-success').addClass('btn-default');
                }

            }
    }); 
})

```

message, it's just test alert message from my django view function. Problem only with replace element