Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <button type = "button" id = "liker" class = "like"><i id = "icon" class="fa fa-heart-o fa-lg"></i></button><p class = "disp"></p>
  2. <script type="text/javascript">
  3.    $(document).ready(function(){
  4.        $(".like").click(function(){
  5.             $.ajax({
  6.                type: "POST",
  7.                url: "favorites_updateDB2-Ashwin.php",
  8.                data: {favorite : '.$fileid.'},
  9.                success: function(data) {
  10.                    $("p.disp").text(data);
  11.                     $("#liker").attr("class","unlike");
  12.                     $("#icon").attr("class","fa fa-heart fa-lg");
  13.                }
  14.             });
  15.        });
  16.  
  17.        $(".unlike").click(function(){
  18.             $.ajax({
  19.                type: "POST",
  20.                url: "favorites_updateDB2-Ashwin.php",
  21.                data: {favorite : '.$fileid.'},
  22.                success: function(data) {
  23.                    $("p.disp").text(data);
  24.                    $("#liker").attr("class","like");
  25.                    $("#icon").attr("class","fa fa-heart-o fa-lg");
  26.                }
  27.            });
  28.        });
  29.   });
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement