Liked variable showing null

I have made a method which changes the color of the like button to red, when it has been liked.
The method changes the color, based on if the variable “Liked” from topics is TRUE or FALSE.
My problem is that this variable show false, even when it has been liked

This is my like method

 function likeIdea(likesId, idea_id, like) {
        if (notLogedIn == true) {
        } else {
            $.post('/post_actions?id=' + idea_id + '&post_action_type_id=2&flag_topic=false?' +, {
                headers: {
                    'X-CSRF-Token': getCsrftoken(),
                    'X-Requested-With': 'XMLHttpRequest'
            }).done(function (data) {
                like += 1;
                $('.like' + idea_id).html(like);
                $("#likes" + likesId).addClass('likesRed');


            }).fail(function (xhr, status, error) {
                if (xhr.status == 422) {
                    alert("like did not go through");

I have tried to like and unlike, but it’s still false.
Some og the likes go trough.