I am trying to execute a php shortcode on button click but that is not running.
HTML button code is as follow..
<html>
<body>
<p align="center">
<button onclick="executeShortCode()">Refresh Date</button>
<script>
function executeShortCode() {
alert("<?php echo do_shortcode('[Test_ShortCode]');?>");
}
</script>
</body>
</html>
PhP shortcode is as follow..
<?php
add_shortcode( 'Test_ShortCode', 'refresh_time' );
function refresh_time( )
{
echo "Refresh Button Press @ " . date("Y/m/d H/i/s") . "<br>";
}
?>