I have a page with the post and a "like" button, when I click the button "like" I would to change it in "dislike", my code in here:
    public function show_all(){
            $query = @mysql_query("SELECT * FROM post INNER JOIN users ON post.id_user = users.id_user ORDER BY post.id DESC") or die('Errore: ' . mysql_error());
                        while($risultato = mysql_fetch_array($query)) {
        echo '<div style=" border: 1px solid #ccc; box-shadow: 1px 1px 1px #ccc; margin-bottom: 20px; padding: 20px; word-wrap:break-word;">
            <ul class="navbar-header pull-right panel_toolbox">
  <li class="dropdown"><a href="#" class="dropdown-toggle"
                                            data-toggle="dropdown" role="button" aria-expanded="false"><i
                                                class="glyphicon glyphicon-chevron-down"></i></a>
                                            <ul class="dropdown-menu pull-right" role="menu">
                                                <li><a href="#">Elimina</a></li>
                                                <li><a href="#">Segnala</a></li>
                                            </ul></li>
                                    </ul>
                <h4>' . $risultato['username'] . '</h4>
                <a href="post.php?id='. $risultato['id'] .'" > ' . $risultato['post'] . '</a>
                <small>
                    <hr>
                    <input id="like" type="button" value="'.$like.'" onclick="like(' . $risultato["id"] . ' );" /> ' . $risultato['like1'] . '
                </small>
            </div> 
';
                        }
    }
And this is my main page:
<script>
    function pullPost() {
                $('#error-msg').html('loading....');
                $.ajax({
                    url: '../class/newsfeed.php',
                    method: "post",
                    success: function(data) {
                        setTimeout(function() {
                            $("#error-msg").fadeOut();
                        }, 3000);
                        $('.news-feed').html(data);
                    },
                    error: function() {
                        $("#error-msg").html('There is some error occured').fadeIn();
                        setTimeout(function() {
                            $("#error-msg").fadeOut();
                        }, 3000);
                    }
                });
            }
            window.onload = function() {
                pullPost();
            };
        </script>
<script>
    function like(id_post, id_user) {
      $.ajax({
           type: "POST",
           url: '../class/like.php',
           data:{id_post:id_post},
           complete: function() {
                            pullPost();
                        }
      });
 }
 </script>
How change "like" button in "dislike"?
 
    