简体   繁体   中英

I want send a confirmation message on clicking on link

I am trying to send activation confirmation message by link variable , here is my link http://polestarllp.com/users/useractive.php?contranumber=23215 , when user click on this link , i just want notify the admin by message.

<script type="text/javascript">
         $(document).ready(function () {
             var person = "<?php $data; ?> ";
                 $.ajax({
                     url: 'http://192.168.1.102:1512/qlikapi/RegisterUser',
                     //type: 'Post',
                     data:person,
                     success: function (data, xhr) {
                     alert(data.ErrorMessage);
                     if(data.Success)
                     {
                    document.location.reload();  
                     }

                     },
                     error: function (xhr, textStatus, errorThrown) {
                         console.log('Error in Operation');
                     }
                 });



         });
    </script>
<style>

php code

    <?php
  $data=$_GET['contranumber'];
?>

I would suggest handling this by PHP code only.

When user opens the page (which effectively happens after clicking the link), php code will validate the request and send a notification / email / whatever required.

It would be safer as the logic (no XHR request in the background) will be hidden from public.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM