`
( () => {
rpnNext.on( 'click', ( e ) => {
e.preventDefault();
rpnNext.disabled = true;
console.log(123);
$.ajax( {
type: 'POST',
url: phpVars.ajaxUrl,
data: {
action: 'related_posts',
postId: rp.data( 'id' ),
paged: rpNavPage + 1
},
beforeSend: () => {
rpSpinner.show();
},
success: ( response ) => {
if ( $.trim( response ) ) {
rpNavPage++;
rpRow.html( response );
}
},
complete: () => {
rpSpinner.hide();
rpnNext.disabled = false;
}
} );
} );
}) ();
`