button onclick with get_post_permalink

get_post_permalink() only returns the value. You still need to echo it (and escape it for good measure):

<?php echo esc_url( get_post_permalink() );?>

tech