0

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'];
?>
Sanjay Yadav
  • 243
  • 3
  • 20

1 Answers1

0

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.

Bart K
  • 324
  • 1
  • 8
  • can you tell me how to save php variable in jquery @@var person = " "; this code is not working , showing blank value of person – Sanjay Yadav Aug 10 '16 at 13:47
  • @SanjayYadav you cannot just pass the variables between JavaScript and PHP. You need to kind of render it into javascript code, as the comment above suggests. – Bart K Aug 10 '16 at 15:08
  • Hi BarT K@@ Friend it working@@ var contranumber = ; – Sanjay Yadav Aug 11 '16 at 08:07