Advertisement
michaelyuen

Untitled

May 20th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     function getLikes() {
  3.             $.ajax({
  4.             url: "get_like.php";
  5.             method: "post";
  6.             data: {"get" : "likes"};
  7.             dataType: "json";
  8.             success: function(data){
  9.                 $(data).each(function(k, v) {
  10.                     $('[data-id='+v.post_id+']').find('span').text(v.likes);
  11.                 });
  12.             }
  13.         });
  14.     }
  15.  
  16. $(document).ready(function(){
  17.     setInterval(function (){
  18.         getLikes();
  19.     }, 1000);
  20. });
  21. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement