Guest User

Untitled

a guest
Sep 14th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.71 KB | None | 0 0
  1. jQuery(document).ready(function($){
  2.  
  3.     $('.zilla-likes').live('click',
  4.         function() {
  5.             var link = $(this);
  6.             if(link.hasClass('active')) return false;
  7.        
  8.             var id = $(this).attr('id'),
  9.                 postfix = link.find('.zilla-likes-postfix').text();
  10.            
  11.             $.post(zilla_likes.ajaxurl, { action:'zilla-likes', likes_id:id, postfix:postfix }, function(data){
  12.                 link.html(data).addClass('active').attr('title','You already like this');
  13.             });
  14.        
  15.             return false;
  16.     });
  17.    
  18.     if( $('body.ajax-zilla-likes').length ) {
  19.         $('.zilla-likes').each(function(){
  20.             var id = $(this).attr('id');
  21.             $(this).load(zilla.ajaxurl, { action:'zilla-likes', post_id:id });
  22.         });
  23.     }
  24.  
  25. });
Add Comment
Please, Sign In to add comment