Magento 2 Confirmation widget confirm action

I’m trying to execute a function on confirm widget confirmation, but the confirm action is firing on load page always.

Here is the HTML:

<a class="action accept" id="accept_user" href="#">     <span>         <?php /* @escapeNotVerified */ echo __('Accept'); ?>     </span> </a> 

And Here the JS:

<script> require([         'jquery',         'Magento_Ui/js/modal/confirm'     ],     function($  , confirmation) {         $  ('#accept_user').on('click', function (e){             e.preventDefault();             confirmation({                 title: 'Accept user',                 content: 'Do you want to accept this user?',                 actions: {                      confirm: function () {                         <?php /* @escapeNotVerified */ echo $  block->activateUser('$  userId'); ?>                     },                      cancel: function () {                         return false;                     }                 }             });         });     }); </script> 

How to execute the confirm action only when user click on Accept button from confirmation modal?

It’s for frontend area.

Thank you!!

How can one confirm that reported transactions on the exchange actually occur and are not due to wash-trading?

For instance, if I’m subscribed to binance’s websocket trade stream.. and it is reporting trades.. how can one be assured that the trades are actually occuring and not just the exchange trading with itself or generating false data to pump up their volume numbers?