I am trying to pass a jquery variable to a PHP variable and then retrieve that variable so I can use it in a php function. The jquery variable is a string and after I pass to PHP and retrieve and echo it, I get nothing.
Here is my simplified code from test.php file.
<?php
 $senderid = $_POST['senderid']; 
 echo $senderid; //I get nothing here.
?>
<script>
$('a.send').on('click', function( event ) {
event.preventDefault();
var href = $(this).attr('href');
var senderID = parseInt(href.split('sender_id=')[1]);
    $.ajax({
        url: 'test.php',
        type: 'POST',
        data: {senderid: senderid},
        success: function(){
          jQuery('.test').text('<?php echo $senderid; ?>'); ///nothing here
        }
    });
});
</script>
