Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * myCRED Points for Link Clicks jQuery Scripts
- * @since 0.1
- * @version 1.3.2
- */
- jQuery(function($) {
- var mycred_click = function( href, title, target, skey, post ) {
- $.ajax({
- type : "POST",
- data : {
- action : 'mycred-click-points',
- url : href,
- token : myCREDgive.token,
- etitle : title,
- key : skey,
- post_id : post
- },
- dataType : "JSON",
- url : myCREDgive.ajaxurl,
- success : function( data ) {
- //console.log( data );
- if ( target == 'self' )
- window.location.href = href;
- },
- error : function( jqXHR, textStatus, errorThrown ) {
- // Debug
- //console.log( jqXHR );
- //console.log( 'textStatus: ' + textStatus + ' | errorThrown: ' + errorThrown );
- }
- });
- };
- $('.mycred-points-link').click(function(){
- var target = $(this).attr( 'target' );
- //console.log( target );
- if ( typeof target === 'undefined' ) {
- target = 'self';
- }
- mycred_click( $(this).attr( 'href' ), $(this).text(), target, $(this).attr( 'data-key' ), $(this).attr( 'data-post' ) );
- if ( target == 'self' ) return false;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement